Software Developer, Equity Analyst, Polymath.
Posts tagged insert
More about insert statement
013 years
by Ray Tawil
in MS Sql Server
I’ve wandered in some forums I’ve found another way to insert multiple data.
before
INSERT INTO TableName (Col1, Col2) VALUES (1, 'John'); INSERT INTO TableName (Col1, Col2) VALUES (2, 'Mike'); INSERT INTO TableName (Col1, Col2) VALUES (3, 'Jane');
another way I found
INSERT INTO TableName (Col1, Col2) SELECT 1 , 'John' UNION ALL SELECT 2 , 'Mike' UNION ALL SELECT 3 , 'Jane' --only in SQL Server 2008 INSERT INTO TableName (Col1, Col2) VALUES (1, 'John'), (2, 'Mike'), (3, 'Jane')