Batch insert data:
Define variables, execute the loop, and convert int to varchar. Example: Convert (varchar (10), @ BMC) Declare @ name varchar (50 );
Declare @ PWD varchar (10 );
Set @ Pwd = '000000 ';
Declare @ BMC int;
Set @ BMC = 101;
While (cast (@ BMC as INT) <120)
Begin
Set @ name = 'tv8' + convert (varchar (10), @ BMC );
Insert into DBO. t_topview_admin (f_psnid, f_status, f_bropwd, f_edittime, f_starttime, f_endtime, f_usertype) values ('tv8' + convert (varchar (10), @ BMC), 1, '123 ', getdate (), 20080320,20090319, 1)
Set @ BMC = @ BMC + 1
End
Batch insert data. This instance imports data from two tables with similar data structures to declare @ FID Int;
Set @ FID = 1;
While @ FID & lt; 100
Begin
Insert into partition (f_id, f_contentid, f_attachname, f_attachsize, f_attachaddress, f_edittime) Select top 1 f_id, f_mailid, f_attachname, f_attachsize, f_attachaddr, f_edittime from DBO. t_tlmail_attach where f_id> @ FID order by f_id ASC
Set @ FID = @ FID + 1
End