alter table [Table] add id int identity(1,1) go declare @i int declare @sql varchar(1000) set @i=0 while @i<=39 begin set @sql='select * into [TB'+ltrim(i)+'] from [Table] where id between @i*50000+1 and (@i+1)*50000' exec(@sql) set @i=@i+1 end
alter table [Table] add id int identity(1,1) go declare @i int declare @sql varchar(1000) set @i=0 while @i<=39 begin set @sql='select * into [TB'+ltrim(i)+'] from [Table] where id between @i*50000+1 and (@i+1)*50000' exec(@sql) set @i=@i+1 end