melissa820
03-14-2007, 01:42 PM
I am used to using MySQL but had to transfer to SQL server for work. I'm trying to figure out how to insert multiple rows with one query. In MySQL the query would be like this:
INSERT INTO Mytable (Name, Number) VALUES ('Joe', 18), ('Bob', 25), ('Mike', 7);
I tried a query like the one above in SQL Server and it gave me an error that said: Incorrect syntax near ','.
Is there a way to do this in SQL Server? Or will I have to resort to doing multiple insert statements?
INSERT INTO Mytable (Name, Number) VALUES ('Joe', 18), ('Bob', 25), ('Mike', 7);
I tried a query like the one above in SQL Server and it gave me an error that said: Incorrect syntax near ','.
Is there a way to do this in SQL Server? Or will I have to resort to doing multiple insert statements?