I'm writing the same small sql script and I'm using Advantage Data Architect 11.10.
One part of my script is create 'cursor' based on the following request:
...
declare myCursor;
declare prefix char(4);
declare tableName char(10);
...
tableName = prefix + '_table1';
open myCursor as select * from tableName;
...
When I run my script, I get the following error:
poQuery: Error 7200: AQE Error: State = HY000; NativeError = 7041; [iAnywhere Solutions][Advantage SQL][ASA] Error 7041: File not found. Verify the specified path and file name is correct. Table name: tableName ** Script error information: -- Location of error in the SQL statement
I understood that mean this error message and I tried to find answer in the Internet.
One of the way to resolve my problem is created dynamically sql.
I found some examples how to use the dynamically sql in Advantage Data Architect but this examples does not work. I created the following code:
...
declare @test string;
...
set @test = 'open myCursor as select * from ' + tableName;
execute(@test);
...
When I run my script, I get the following error:
Expected lexical element not found: Expecting keyword PROCEDURE, IMMEDIATE, DPRINT or PRINT after the EXECUTE keyword. -- Location of error in the SQL statement is:
And I would like to ask you, may be anybody know how to resolve my problem?
Thank you.
Sorry for my English.