SQL 分批循环更新数据

 USE DBName

GO

 

WHILE ( 1 = 1 )

    BEGIN

 

        UPDATE TOP ( 1000 )

                dbo.TableName

        SET     Filter= ''

        WHERE   Filter IS NULL

 

        IF @@ROWCOUNT < 1000

            BREAK

 

        WAITFOR DELAY '00:00:10'

    END

posted @ 2016-03-04 13:12  anranstl  阅读(753)  评论(0编辑  收藏  举报