Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread sqlscript syntax
Thu, Jul 13 2006 8:35 AMPermanent Link

Jerry Blumenthal
The v2.12 manual says each sqlscript statement must terminate with a
semicolon. I am using ALTER TABLE to add or redefine a field, and then
want to change the major version.  Do I need to use ALTER TABLE in both
statements as below?

ADD('ALTER TABLE "mytbl.dat" ADD myField CHAR(10);')
ADD('ALTER TABLE "mytbl.dat" USER MAJOR VERSION 2 USER MINOR VERSION 4');

or is it ok to write

ADD('ALTER TABLE "mytbl.dat" ADD myField CHAR(10);')
ADD('USER MAJOR VERSION 2 USER MINOR VERSION 4');

Jerry
Thu, Jul 13 2006 10:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jerry


I think you'll find the definition of an sqlscript statement to mean the whole statement not each line eg when adding multiple fields the statement would be

ALTER TABLE Fred
ADD COLUMN C1 INTEGER AT 3,
ADD COLUMN C7 BOOLEAN,
ADD COLUMN LoadsOfText MEMO;


But note the comma separating each bit of the statement. These are needed to separate commands within a statement, but not directives (I think - I generally suck'n'see) so if you didn't want a backup creating the statement would be

ALTER TABLE Fred
ADD COLUMN C1 INTEGER AT 3,
ADD COLUMN C7 BOOLEAN,
ADD COLUMN LoadsOfText MEMO
NOBACKUP;

ie without a comma after MEMO

At least that's the case in V4 - I wasn't using SQL back in 2.12 - strictly tables Smiley

Roy Lambert
Thu, Jul 13 2006 2:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jerry,

<< or is it ok to write

ADD('ALTER TABLE "mytbl.dat" ADD myField CHAR(10);')
ADD('USER MAJOR VERSION 2 USER MINOR VERSION 4'); >>

It would be this (as Roy stated):

ADD('ALTER TABLE "mytbl.dat" ADD myField CHAR(10)');   <<<  No semicolon
here
ADD('USER MAJOR VERSION 2 USER MINOR VERSION 4');

--
Tim Young
Elevate Software
www.elevatesoft.com

Image