Rajamohan Anguchamy
Rajamohan Anguchamy

Reputation: 1736

SQL Server 2008 query for inserting error

insert into salary(name, basic) 
values('EEE', 20000), ('FFF', 25000)

Error:

Incorrect syntax near 'FFF'.

name column is of type varchar and basic columns is of type int.

I am using SQL Server 2008

Upvotes: 0

Views: 368

Answers (2)

Praveen Kumar
Praveen Kumar

Reputation: 1658

Try this one

insert into salary(name, basic) values('EEE', 20000);

Upvotes: 0

Vishwanath Dalvi
Vishwanath Dalvi

Reputation: 36681

I'm successfully able to create table and insert using same query which you are using.

http://sqlfiddle.com/#!3/a09da/1

CREATE table salary(name varchar(20),[basic] int);

insert into salary(name,[basic]) 
values('EEE',20000), 
('FFF',25000);

SELECT * from salary;

Read this for Insert multiple using one query.

Note : As Leslie Davies pointed out this syntax for inserting multiple records using one insert query is only works with MS SQL server 2008.

Upvotes: 5

Related Questions