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

posted @ 2016-12-04 18:59  除除  阅读(464)  评论(0编辑  收藏  举报