Consultor Eletrônico



Kbase 21910: MS SQLServer DataServer Returns "Incorrect Systax near '1'".
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/22/2002
SUMMARY:

If you created a Progress SQL Server DataServer Schema holder by pulling the schema from the Microsoft SQL Server Database (which has the field name(s) beginning with numeric characters) and you use the Progress-supplied ODBC SQL Server driver, you might get the following
error when you try to assign or update values on that field:

37000:[Microsoft][ODBC SQL Server]Line1:Incorrect Syntax
near'1'.

EXPLANATION:

When you pull the schema from a SQL Server Database that has field name(s) that begin with numeric characters, Progress puts a "z" before the field name. That is because Progress does not support field names that start with a numeric string. When you try to assign or update that field using Progress 4GL through the DataServer, the query is processed as shown by the following examples:

These examples were taken from the DataServer log file with the -Dsrv
qt_debug,EXTENDED switch on.

From the Microsoft-supplied SQL Server ODBC Driver:

14:58:49 Execute old: INSERT INTO "jeff"."dbo"."section1" (
"field1","1a") VALUES (?,?)

- OR -

From the Progress-supplied ODBC SQL Server Driver:

16:24:31 Execute new: INSERT INTO jeff.dbo.section1 ( field1,1a)
VALUES (?,?)

16:24:31 (pid 491) LOCAL MSS USER pdb: jeff1 ldb: lgtest
SQLState: 37000 Native Error Code: 170 Error Message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Line
1:Incorrect syntax near '1'.

16:24:31 (pid 491) LOCAL MSS USER pdb: jeff1 ldb: lgtest
SQLState: 37000 Native Error Code: 8180 Error Message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s)
could not be prepared.

If you look at the two insert statements from the dataserv.lg file above, you can see the Progress-supplied ODBC SQL Server driver did not put the double quote around the field names. This was the reason for the syntax error. If you use the SQL Server query analyzer tool, you are required to put the square brackets around the field name th