I have a table with a column name called “index”
select id, index
from item;
gives an error:
Msg 1018, Level 15, State 1, Line 1 Incorrect syntax near ‘index’. If
this is intended as a part of a table hint, A WITH keyword and
parenthesis are now required. See SQL Server Books Online for proper
syntax.
How can I do a select on a column named index? I’m using sqlserver 2008-R2
Use square brackets to quote reserved words:
See also the documentation on Delimited Identifiers.