Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Error #700 - (Expected end of expression but instead found Create)
Sat, Aug 7 2010 10:33 PMPermanent Link

John Evans

Hi,

I am trying to follow the example of the CDCollector demo for creating tables at application start up if they don't exist.


The database gets created successfully but when I run table code I am getting the follow error:

'ElevateDB error #700. An error was found in the statement at line 2 column 1 (Expected end of expression but instead found Create).

----------------
with CatalogQuery do
 begin
   SQL.Text := 'SELECT * FROM Information.Tables WHERE Name=''tblFred''';
   Open;
   if (RecordCount = 0) then
   begin
     Close;
     SQL.Add('CREATE TABLE "tblFred"');
     SQL.Add('(');
     SQL.Add('"fRef" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1000, INCREMENT BY 1),');
     SQL.Add('"fDate" VARCHAR(10) COLLATE "ANSI",');
     SQL.Add('"fTime" VARCHAR(10) COLLATE "ANSI",');
     SQL.Add('"fAmPm" VARCHAR(10) COLLATE "ANSI",');
     SQL.Add('"fEvent" VARCHAR(20) COLLATE "ANSI",');
     SQL.Add('"fScript" VARCHAR(10) COLLATE "ANSI",');
     SQL.Add('"fTask" VARCHAR(20) COLLATE "ANSI",');
     SQL.Add('"fTrimmed" INTEGER DEFAULT 0,');
     SQL.Add('CONSTRAINT "PrimaryKey" PRIMARY KEY ("fRef")');
     SQL.Add('(');
     SQL.Add('DESCRIPTION ''Import Fred Log File''');
     ExecSQL;
   end
   else
     Close;
------------------


Thanks

John
Sat, Aug 7 2010 11:13 PMPermanent Link

Charles Tyson

Don't you need to SQL.Clear after the Close statement, to delete the
SELECT command?


On 8/7/2010 7:33 PM, John Evans wrote:
> Hi,
>
> I am trying to follow the example of the CDCollector demo for creating tables at application start up if they don't exist.
>
>
> The database gets created successfully but when I run table code I am getting the follow error:
>
> 'ElevateDB error #700. An error was found in the statement at line 2 column 1 (Expected end of expression but instead found Create).
>
> ----------------
>   with CatalogQuery do
>    begin
>      SQL.Text := 'SELECT * FROM Information.Tables WHERE Name=''tblFred''';
>      Open;
>      if (RecordCount = 0) then
>      begin
>        Close;
>        SQL.Add('CREATE TABLE "tblFred"');
>        SQL.Add('(');
>        SQL.Add('"fRef" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1000, INCREMENT BY 1),');
Sat, Aug 7 2010 11:13 PMPermanent Link

Charles Tyson

Don't you need to SQL.Clear after the Close statement, to delete the
SELECT statement?


On 8/7/2010 7:33 PM, John Evans wrote:
> Hi,
>
> I am trying to follow the example of the CDCollector demo for creating tables at application start up if they don't exist.
>
>
> The database gets created successfully but when I run table code I am getting the follow error:
>
> 'ElevateDB error #700. An error was found in the statement at line 2 column 1 (Expected end of expression but instead found Create).
>
> ----------------
>   with CatalogQuery do
>    begin
>      SQL.Text := 'SELECT * FROM Information.Tables WHERE Name=''tblFred''';
>      Open;
>      if (RecordCount = 0) then
>      begin
>        Close;
>        SQL.Add('CREATE TABLE "tblFred"');
>        SQL.Add('(');
>        SQL.Add('"fRef" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1000, INCREMENT BY 1),');
Sat, Aug 7 2010 11:14 PMPermanent Link

Charles Tyson

This message was cancelled from within Mozilla Thunderbird.
Sun, Aug 8 2010 12:10 AMPermanent Link

John Evans

..correct some syntax but still having same error

john
Sun, Aug 8 2010 12:20 AMPermanent Link

John Evans

Thanks. Clear solved the problem.
Image