Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Insert statement

Author  Topic 

petek
Posting Yak Master

192 Posts

Posted - 2008-10-24 : 04:56:18
Hi all

I cant get the code below to work it retunrs the following error:

Msg 102, Level 15, State 1, Line 5
Incorrect syntax near '‘'.



INSERT INTO T1 (Col1,Col2,Col3)
VALUES

(‘Row1', ‘Value’,‘Test’),
(‘Row2', ‘Value’,‘Test’),
(‘Row3', ‘Value’,‘Test’)


help

Kind Regards

Pete.

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-10-24 : 05:02:32
USE UNION ALL
See

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=112659
Go to Top of Page

PeterNeo
Constraint Violating Yak Guru

357 Posts

Posted - 2008-10-24 : 05:02:39
u should not use "`", use "'"(single quote)

try like this

INSERT INTO T1 (Col1,Col2,Col3)
VALUES('Row1', 'Value','Test')
INSERT INTO T1 (Col1,Col2,Col3)
VALUES('Row2', 'Value','Test')
INSERT INTO T1 (Col1,Col2,Col3)
VALUES('Row3', 'Value','Test')

if u r using sql 2008 try this

INSERT INTO T1 (Col1,Col2,Col3)
VALUES('Row1', 'Value','Test')
, ('Row2', 'Value','Test')
, ('Row3', 'Value','Test')



"There is only one difference between a dream and an aim. A dream requires soundless sleep to see, whereas an aim requires sleepless efforts to achieve..!!"
Go to Top of Page

petek
Posting Yak Master

192 Posts

Posted - 2008-10-24 : 05:07:54
Thank you PeterNeo.

Kind Regards

Pete.
Go to Top of Page
   

- Advertisement -