declare @i int
declare @j int,@k int
while @j<=100 //逐条取USER表里的前100个User_ID
begin
set @k=@j+1
select top (@k) @uid=User_ID from USER where User_ID not in (select top (@j) User_ID from USER) //
set @i=1
while @i<=100
begin //将数据插入到RECORD中
INSERT INTO RECORD ( Record_ID , Record_UserNo , Record_Date, Record_Device, Record_Type )VALUES ( NEWID() ,@uid , dateadd(DAY,@i,'2014-04-01'), 1, 1 )
set @i=@i+1
end
set @j=@j+1
end
declare @j int,@k int
declare @uid varchar(250)
while @j<=100 //逐条取USER表里的前100个User_ID
begin
set @k=@j+1
select top (@k) @uid=User_ID from USER where User_ID not in (select top (@j) User_ID from USER) //
set @i=1
while @i<=100
begin //将数据插入到RECORD中
INSERT INTO RECORD ( Record_ID , Record_UserNo , Record_Date, Record_Device, Record_Type )VALUES ( NEWID() ,@uid , dateadd(DAY,@i,'2014-04-01'), 1, 1 )
set @i=@i+1
end
set @j=@j+1
end