all groups > sql server programming > october 2007 >
You're in the

sql server programming

group:

how to insert into index



how to insert into index Andy
10/31/2007 8:41:31 PM
sql server programming: Hi,
I have some table in old DB with column named "index".
How to write insert statement to not get an error?
if I try to do that SQl Server is saying "error near index...etc"
insert into table (index, name) values (1,'Bob')
got to be some workaround?
thanks

Re: how to insert into index Andy
10/31/2007 10:02:26 PM
Hi,
It works!
thank you very much,

[quoted text, click to view]

Re: how to insert into index jhofmeyr NO[at]SPAM googlemail.com
11/1/2007 1:25:25 AM
[quoted text, click to view]

Hi Andy,

The problem is because the word "index" (and in-fact the word "name"
as well, but SQL is more forgiving with this one) is a reserved word
in SQL Server.
Try:
INSERT INTO table ([index], [name])
VALUES (1, 'Bob')

--CELKO-- might tell you that Standard SQL convention is to use double
quotes instead of square brackets, but I prefer the brackets myself :)

Good Luck!
J
AddThis Social Bookmark Button