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
.
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"
精彩评论