Sql Server生成測試資料

衣舞晨風發表於2015-04-23
GO 
create table tb_TestTable400 --建立表 
( 
id int identity(1,1) primary key, 
userName nvarchar(40) not null, 
userName1 nvarchar(40) not null, 
userName2 nvarchar(40) not null, 
userName3 nvarchar(40) not null, 
userName4 nvarchar(40) not null, 
userName5 nvarchar(40) not null, 
userName6 nvarchar(40) not null, 
userName7 nvarchar(40) not null, 
userName8 nvarchar(40) not null, 
userName9 nvarchar(40) not null, 
userName10 nvarchar(40) not null, 
userPWD nvarchar(40) not null, 
userPWD1 nvarchar(40) not null, 
userPWD2 nvarchar(40) not null, 
userPWD3 nvarchar(40) not null, 
userPWD4 nvarchar(40) not null, 
userPWD5 nvarchar(40) not null, 
userPWD6 nvarchar(40) not null, 
userPWD7 nvarchar(40) not null, 
userPWD8 nvarchar(40) not null, 
userPWD9 nvarchar(40) not null, 
userPWD10 nvarchar(40) not null, 
userPWD11 nvarchar(40) not null, 
userPWD12 nvarchar(40) not null, 
userPWD13 nvarchar(40) not null, 
userPWD14 nvarchar(40) not null, 
userEmail nvarchar(40) null 
) 
GO











set identity_insert tb_TestTable400 on 
declare @count int 
set @count=1 
while @count<=4000000 
begin 
insert into tb_TestTable400( id , userName, userName1, userName2,userName3, userName4, userName5, userName6, userName7, userName8, userName9, userName10, userPWD, userPWD1,userPWD2, userPWD3, 
userPWD4, userPWD5, userPWD6, userPWD7, userPWD8, userPWD9, userPWD10, userPWD11, userPWD12,userPWD13, userPWD14, userEmail ) values(@count,newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid(),newid()) 
set @count=@count+1 
end 
set identity_insert tb_TestTable400 off


通過vs2010生成測試資料:

http://blog.csdn.net/jiankunking/article/details/45221313

相關文章