on 2020 Oct 22 10:31 AM
with SQL Anywhere Network Server Version 17.0.10.6160 I experience the following effect:
SELECT MyCount = count() FROM Table WHERE TableID = '58693';
leads to the error "ERROR [42000] [Sybase][ODBC Driver][SQL Anywhere]Syntax error near ';' on line 1 " But
SELECT count() as MyCount FROM Table WHERE TableID = '58693';
works fine. Can anyone explain?
Based on information provided in the support incident, I was able to reproduce this error. A database created pre-v17 and not upgraded will report a syntax error due to the trailing semicolon in some interfaces such as ODBC:
SELECT MyCount = count() FROM Table WHERE TableID = '58693';
To reproduce, I modified the sample odbcselect to execute:
SELECT mycount = count() FROM syshistory;
which reported the syntax error in a database created with 16.0 Build 1691 but not after upgrading the database using 17.0 build 6160 or with a database created with that same 17.0 release.
Several options to resolve this are available
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have also reproduced this using the SQL Anywhere .NET driver with the same findings. There is a need to upgrade or create the database in v17 to get support for the semi-colon terminator for Transact-SQL based statements.
My SQL is a bit rusty... but I believe the first syntax (which generates the error) is TSQL which does not use semicolons to separate statements, whereas the second is WATCOM SQL which does use semicolons.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
9 | |
9 | |
8 | |
8 | |
7 | |
7 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.