每一次运行后就记下已取记录数或次数,就设为@index的值,再执行以下存储过程:
create procedure proTest
(
@index varchar(10)
)
as
declare @sql varchar(8000)
set @sql = 'select top 2 from tab a where not exists('
set @sql = @sql + 'select top '+@index+' from tab b where a.IP = b.IP and a.Time = b.Time)'
exec(@sql)
go
create procedure proTest
(
@index varchar(10)
)
as
declare @sql varchar(8000)
set @sql = 'select top 2 from tab a where not exists('
set @sql = @sql + 'select top '+@index+' from tab b where a.IP = b.IP and a.Time = b.Time)'
exec(@sql)
go
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货