SQLServer索引循环删除

来源:互联网 发布:使用gson解析json数据 编辑:程序博客网 时间:2024/06/06 18:34
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

原创粉丝点击