Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Execute a multi alters using EDB Manager.
Tue, Sep 25 2012 1:05 PMPermanent Link

Abdulaziz Al-Jasser

Hi,

In DBISAM3 I can run multiple SQL clauses using Database system utility separated by semicolon.  But I get an error on the second line if I try to run the same multiple lines script in EDB Manager.  Can this be done in EDB Manager?

Sample:


ALTER TABLE TB_AccountsChart        ALTER COLUMN AccountAddress      AS VARCHAR(1024);
ALTER TABLE TB_BranchSetup          ALTER COLUMN InvoiceEndText      AS VARCHAR(100);
ALTER TABLE TB_CarsOwners           ALTER COLUMN Address             AS VARCHAR(1024);
ALTER TABLE TB_CarsSetup            ALTER COLUMN DeliveryTerms       AS VARCHAR(200);


Regards,
Abdulaziz Jasser
Tue, Sep 25 2012 1:45 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Abdulaziz,

Yes, you can.
But the default statement terminator character is not ";" but "!" .
You can also change the terminator character at Edit/Preferences/Editor if you want.

--
Fernando Dias
[Team Elevate]
Tue, Sep 25 2012 1:45 PMPermanent Link

Uli Becker

Abdulaziz,

You can't. Use a script like this:

SCRIPT
BEGIN

Execute Immediate 'ALTER TABLE TB_AccountsChart
                             ALTER COLUMN AccountAddress
                             AS VARCHAR(1024)';

Execute Immediate 'ALTER TABLE TB_BranchSetup
                             ALTER COLUMN InvoiceEndText
                             AS VARCHAR(100)';

....


END
Tue, Sep 25 2012 1:48 PMPermanent Link

Uli Becker

Fernando,
> Yes, you can.
> But the default statement terminator character is not ";" but "!" .
> You can also change the terminator character at Edit/Preferences/Editor

I just wrote "You can't". Smile

Actually you can write multiple statements separated by a terminator,
but you can only execute one of them.

Uli
Tue, Sep 25 2012 1:55 PMPermanent Link

Abdulaziz Al-Jasser

Fernando,
Uli,

You guys are great.  Thanks for the help...


Regards,
Abdulaziz Jasser
Tue, Sep 25 2012 1:58 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

<< Actually you can write multiple statements separated by a terminator, but you can only execute one of them.>>

Only if you select *exactly* one statement in the left gutter.
Otherwise all the selected statements are going to be executed, or if none selected all the statements are executed.

BTW Abduaziz, if you want to change the terminator character, do *not* use ";" as it might cause issues with some statements.
 
--
Fernando Dias
[Team Elevate]
Tue, Sep 25 2012 2:08 PMPermanent Link

Abdulaziz Al-Jasser

Fernando,

For sure I will consider that.  Thanks again.


Regards,
Abdulaziz Jasser
Wed, Sep 26 2012 2:17 AMPermanent Link

Uli Becker

Fernando,

> Only if you select *exactly* one statement in the left gutter.
> Otherwise all the selected statements are going to be executed, or if
> none selected all the statements are executed.

Ups, I didn't know (and have never used) that. Thanks for the clarification!

Regards Uli
Wed, Sep 26 2012 3:11 AMPermanent Link

Uli Becker

Abdulaziz,

> You can't. Use a script like this:

Like Fernando posted, I was wrong. You *can*. Smile

Uli
Wed, Sep 26 2012 9:55 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Uli,

<< I was wrong. You *can*. Smile>>

Yes, but your suggestion of using dynamic SQL in a script is also correct and a good alternative as it would work not only in EDB Manager but also it could be used in any application.

--
Fernando Dias
[Team Elevate]
Image