0
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

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

9 Comments

No problem here either. Only thing can think of is [name] and [basic]
thanks for your comments, sorry this not working :(, i am already try this one
@raja can you drop your salary table and try running the code I've provided in answer.
Are you sure you are running SQL Server 2008? This multiple record insert feature was added in 08 as far as I know and the above syntax is not available in SQL Server 2005.
i am use that query already in another one table, now it's problem of that, i am using MS SQL SERVER 2008
|
0

Try this one

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

1 Comment

If you post code, XML or data samples, PLEASE highlight those lines in the text editor and click on the "code samples" button ( { } ) on the editor toolbar to nicely format and syntax highlight it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.