Insert Data Dynamically in SQL Server

    In this tutorial see about SQL Server insert Data Dynamically.

create a table  tbl_name
     create table tbl_name(id int identity primary key,name nvarchar(20),age int)




declare @ID as int
set @ID=1
while(@ID<=5)
begin
insert into tbl_name values('name'+ CAST(@ID as nvarchar(20)),@ID)
print @ID
set @ID=@ID+1
end

Output:


Comments

Popular posts from this blog

Unable to perform operation on the item is locked in workspace

Maximum Stored Procedure Function Trigger or View Nesting Level Exceeded (limit 32) in SQL Server

Insecure cookie setting: missing Secure flag