Friday, March 8, 2013

insert multiple rows sql server 2008



For inserting multiple rows using one insert statement you can do as following example :
declare @dept table
 (
   DeptId int identity(1,1) not null,
   DeptName nvarchar(500)
 )

 insert into @dept values ('sales'),('marketting'),('hr'),('IT')

 select * from @dept 

SQL fiddle can be check here  

No comments:

Post a Comment

.net core

 Sure, here are 50 .NET Core architect interview questions along with answers: 1. **What is .NET Core, and how does it differ from the tradi...