SQL Server循环执行插入10000条数据

代码
1 -- 循环执行插入10000条数据
2 declare @vendorID int
3 declare @name nvarchar( 100 )
4 declare @address nvarchar( 255 )
5 declare @phone nvarchar( 255 )
6 declare @vendorName nvarchar( 100 )
7 declare @vendorAddress nvarchar( 255 )
8 declare @vendorPhone varchar( 50 )
9 begin
10 set @vendorID = 1
11 set @name = ' Eva '
12 set @address = ' Softtek '
13 set @phone = ' 13013623506 '
14 set @vendorName = ' Eva1 '
15 set @vendorAddress = ' Softtek1 '
16 set @vendorPhone = ' 13013623507 '
17 while @vendorID < 10000
18 begin
19 insert into Suppliers(vendorID,vendorName,vendorAddress,vendorPhone)
20 values(@vendorID,@vendorName,@vendorAddress,@vendorPhone)
21 set @vendorID = @vendorID + 1
22 set @vendorName = @name + cast(@vendorID as nvarchar)
23 set @vendorAddress = @address + cast(@vendorID as nvarchar)
24 set @vendorPhone = @phone + cast(@vendorID as nvarchar)
25 end
26 end

 

转载于:https://www.cnblogs.com/eva_2010/articles/1940164.html

你可能感兴趣的:(SQL Server循环执行插入10000条数据)