Insert Multiple Rows in MS SQL Server

Ideally:

insert into Navigator_Item_Sorting (parent_id, item_id, sort_order) values (34, 35, 0 ), (34, 40, 1 ), (34, 118, 2 ), (34, 37, 3 )

Sadly, this will work after SQL Server 2008! Before that version, this statement should be:

insert into dbo.Navigator_Item_Sorting (parent_id, item_id, sort_order)
select 34, 35, 0
union all
select 34, 40, 1
union all
select 34, 118, 2
union all
select 34, 37, 3

MicroSoft sucks everywhere!!!!

4 thoughts on “Insert Multiple Rows in MS SQL Server

Comments are closed.