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.
| Author |
Topic |
|
on9west
Starting Member
2 Posts |
Posted - 2008-06-16 : 01:18:56
|
| Hello everyoneI am using MS SQL Server Management Studio Express. When I apply multiple insert statement, it doesn't allow me to do so. I have to do it one by one, which is time consuming.SampleINSERT INTO table (col_a,col_b) VALUES (1,1)INSERT INTO table (col_a,col_b) VALUES (2,2)INSERT INTO table (col_a,col_b) VALUES (3,3)Any ideas? I want to do it in one go. Thank you very much. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-16 : 01:48:19
|
| [code]INSERT INTO table (col_a,col_b) SELECT 1,1UNION ALLSELECT 2,2UNION ALLSELECT 3,3....[/code]However if you've SQL 2008 you can use it like this[code]INSERT INTO table (col_a,col_b) VALUES (1,1),(2,2),(3,3)[/code] |
 |
|
|
|
|
|
|
|