Reputation: 107
What's the proper syntax for a row delete via an identity column? The query:
"DELETE FROM [table] WHERE [column 'count'] = 1"
works. While the same query where the identity column is 'index' fails.
"DELETE FROM [table] WHERE index = 1"
I'm trying to delete the last inserted row with IDENT_CURRENT([table]).
Upvotes: 0
Views: 170
Reputation: 135848
Index is a reserved word. You have to escape it with square brackets.
DELETE FROM [table] WHERE [index] = 1
And be sure to give a special "thanks" to whoever designed the schema with that column name in the first place.
Upvotes: 4
Reputation: 172548
Try this:
DELETE FROM [table] WHERE [index] = 1
as index is a reserved keyword in Sql Server.
Upvotes: 0