SQLServer索引循环删除
declare qc_cursor cursor SCROLL OPTIMISTIC For
select siteName from tb_vhostcheck
open qc_cursor
declare @siteName nvarchar(50)
while @@fetch_status=0
begin
fetch next from qc_cursor into @siteName
--print @siteName
if not exists(select 1 from vhhostlist where s_comment= @siteName)
begin
print @siteName
delete from tb_vhostcheck where siteName=@siteName
end
end
close qc_cursor
deallocate qc_cursor
GitHub: https://github.com/mazeyqian
Blog: https://blog.mazey.net/
Blog: https://blog.mazey.net/