tsql - How can I convert this function into sql server function? -


i'm not pro in tsql, i've function:

for (i=1;i<=30;i++) {     (j=1;j<=10;j++){         insert names values ("","","name"+i+" - fn"+j", "name"+i+" - fn"+j", "numeric", "r",0,"n",0,"00");      } } 

i want convert sql function insert's 300 records (30x10 ) @ once.

you can't insert on function. if understood correctly, want:

declare @i int, @j int set @i = 1 set @j = 1  while @i <= 30 begin     while @j <= 10     begin         insert names         select  '',                 '',                 'name'+cast(@i varchar(2))+' - fn'+cast(@j varchar(2)),                 'name'+cast(@i varchar(2))+' - fn'+cast(@j varchar(2)),                 'numeric',                 'r',                 0,                 'n',                 0,                 '00'          set @j = @j + 1     end     set @j = 1     set @i = @i + 1 end 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -