开发者

SQL query "OBJECT" problem?

Hi I have a table which contains filed name as OBJECT.

I am trying to fetch records from the ta开发者_如何学Cble using select query as follows:

SELECT * 
  FROM table1 
 WHERE OBJECT = "11";

I am getting the following error - INVALID COLUMN NAME.

Looks like its reading OBJECT as SQL KEYWORD and not as table field name.

I am writing this query in sql server management studio.


Enclose keywords in brackets:

SELECT * FROM table1 WHERE [OBJECT] = '11'


Try

select * from table1 where [OBJECT] = '11';

MSDN: Delimited Identifiers

Btw, here is another SO-question to this issue.


Use single quotation marks. But if object is numeric, don't use any quotation marks around the number 11.

             where mycol = 'x'  

             not 

           where mycol = "x"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜