• Post Reply Bookmark Topic Watch Topic
  • New Topic

Incorrect syntax near ','.

 
R Naijat
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21969
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!