File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Incorrect syntax near ','. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Incorrect syntax near Watch "Incorrect syntax near New topic
Author

Incorrect syntax near ','.

R Naijat
Ranch Hand

Joined: Nov 01, 2011
Posts: 40
Hi all,
I use MS SQL Server. I don't know what I'm doing wrong in the following query.

I receive this error:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.


select (table.isNegative, matchType.code, keyword.id, status.code, keyword.lastUpdate, syncStatus.code)
from table kwd, matchType, keyword k, status, syncStatus
where k.id=65648093
and kwd.umbrellaId=1080
and matchType.code='P'
and status.code='A'
and syncStatus.code='B';

Any help would be greatly appreciated.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18116
    
    8

I'm going to guess that "table" is a reserved word in your database. (Do you really have a table named "table"?)
R Naijat
Ranch Hand

Joined: Nov 01, 2011
Posts: 40
Found the problem! Needed to remove the open and close () from the beginning and end of SELECT statement which got rid of the first error. Then I got "cannot be bound" error which I resolved when I replaced the actual table names with the names which was defined in from statement: kwd for table and k for keyword.

Thanks anyway.
 
 
subject: Incorrect syntax near ','.
 
Similar Threads
Updating multiple tables in one sql query
Solved : JTDS MSSQL Pagination problem.
update error
SCJD I passed...I think
Regarding Foreign Key Restricts when Alter data type in sql table