22,209
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE [dbo].[inserttest](
[id] [int] NULL,
[name] [nvarchar](100) NULL,
[male] [nvarchar](10) NULL,
[age] [int] NULL
) ON [PRIMARY]
GO
ALTER proc [dbo].[insert_test](@count1 int,@count2 int)--@count1=1,@count2=10000000
as
while(@count1<@count2)
begin
if @count1%2=0
insert into testinsert.dbo.inserttest values(@count1,'a'+CONVERT(nvarchar,@count1 ),'f',@count1)
else
insert into testinsert.dbo.inserttest values(@count1,'a'+CONVERT(nvarchar,@count1 ),'m',@count1)
set @count1=@count1+1
end
exec insert_test 1,101
go
exec insert_test 101,201
go
select a.*
from inserttest a
where a.id not in(select top 100 id from inserttest )
(100 row(s) affected)