Incorrect syntac nead the keyword 'User'

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
treierts
Posts: 5
Joined: Thu 03 Mar 2005 10:30

Incorrect syntac nead the keyword 'User'

Post by treierts » Thu 03 Mar 2005 10:34

I have just changed from the standard Borland Delphi 2005 driver to the CoreLab dbExpress driver. My application compiles fine but I get the following error when opening the table "User" at runtime:

---------------------------
Error
---------------------------
Database Server Error: Incorrect syntax near the keyword 'User'
---------------------------
OK
---------------------------

This does not happen with the standard MSSQL driver. Is this a bug or is it my fault having designed a database with a table called "User". Since it works with the standard version I would assume that it should also work with the CoreLab driver.

Please advice.

Best Regards,

Tom Reiertsen

treierts
Posts: 5
Joined: Thu 03 Mar 2005 10:30

Additional information

Post by treierts » Thu 03 Mar 2005 10:45

Btw. I was using a TSQLTable component holding the "User" table. If I change this to a TSQLQuery componentn and do the following SQL it works:

SELECT * FROM "User"

Tom.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Fri 04 Mar 2005 12:04

It is a specific of MS SQL. On reference to User table its name must be quoted ("User").
TSQLTable doesn't support this specific and generates a query incorrect from the point of view of MS SQL ("SELECT * FROM User")

treierts
Posts: 5
Joined: Thu 03 Mar 2005 10:30

Post by treierts » Fri 04 Mar 2005 12:11

Yes, I realize that.

But in my original post I explain that the Borland driver works fine with this configuration while your driver does not. I am assuming that the Borland driver then *always* encloses the table name in "" chars.

Can you comment and further on this?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Sat 05 Mar 2005 14:04

You are right, standard driver always puts quote. Now we are considering a possibility of adding such functionality to DbxSda. On the one hand, a compatibility rises in the cases when key fields are used in TSQLTable as a name. On the other hand, a readability of the query text is reduced for the rest cases.

Post Reply