SQL Server 2000删除大数据量,解决阻塞---------循环,删除小量数据
declare @i int
declare @usedate datetime
set @i=19582000
while @i<30231929
begin
select @usedate = getdate()
delete from servicesubscription where subscriptionid <= @i and subscriptionid<=30231928
insert into test..aaamovielogs values(@i,@usedate,getdate(),@@rowcount)
set @i=@i+1000
if(@i>30231928)
set @i=30231928
WAITFOR DELAY '00:00:05'
end