We created a file call TESTREAD.SQL which contains only one statement:
SELECT 1 AS Col_Name FROM DUMMY;
In the Interactive SQL we were able to execute this statement:
READ C:\TEMP\TESTREAD.SQL
Which return:
Col_Name
1
No problem here.....But when we included IF...THEN...ELSE...ENDIF
IF (@@SERVERNAME = @@SERVERNAME) THEN
READ C:\TEMP\TESTREAD.SQL
ELSE
READ C:\TEMP\TESTREAD.SQL
END IF;
We got this error:
Could not execute statement.
Syntax error near 'READ' on line 2
SQLCODE=-131, ODBC 3 State="42000"
Line 1, column 1
Any help in this matter is truly appreciative.
Best regards,
Rachan Terrell
READ is an Interactive SQL command. As soon as you start using the
IF...THEN...ELSE...ENDIF syntax, you have created a batch statement which
is executed directly by the database engine. The database engine has
no knowledge of the READ command, so you get the error "syntax error near
read" that you are seeing.
--
Reg Domaratzki, Sybase iAnywhere Solutions
Please reply only to the newsgroup
iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Docs : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swd/base.do
-> Choose SQL Anywhere Studio
-> Set filter to "Display ALL platforms IN ALL MONTHS"
Thank for your help.
Best regards,
Rachan Terrell
"Reg Domaratzki [Sybase iAnywhere]" <FirstName...@ianywhere.com> wrote
in message news:Xns9BB6807A454BC...@10.22.241.106...
With some effort you can do some interesting things with nested *.sql
files and PARAMETERS substitution.
If you tell us what you are trying to accomplish, perhaps someone will
have an idea... start a new thread, not a reply to this one.
Breck
On 18 Feb 2009 09:18:54 -0800, "Rachan Terrell" <web2...@hotmail.com>
wrote:
--
Breck Carter http://sqlanywhere.blogspot.com/
RisingRoad SQL Anywhere and MobiLink Professional Services
breck....@risingroad.com