declare @i int set @i=1 while(@i<=10) begin INSERT INTO [dbo].[Settlements] ([ID] ,[Count] ,[SettlementDate]) VALUES (
newid() ,cast( floor(rand()*100) as int) --随机int ,DATEADD(DAY,1,(select top 1 [SettlementDate] from [Settlements] order by [SettlementDate] desc )) --获取表中最大的日期然后加1
) set @i=@i+1 end