Delete SQL Server 2005 records without logging

前端 未结 7 1123
北恋
北恋 2020-12-28 08:15

How to delete records from SQL Server 2005 tables without logging them into transaction logs.

I do not wish to log because once deleted, those records will never be

7条回答
  •  既然无缘
    2020-12-28 08:41

    It's easy:

    DECLARE @BatchSize INT
    SET @BatchSize = 100000
    
    WHILE @BatchSize <> 0
    BEGIN
        DELETE TOP (@BatchSize)
        FROM [dbo].[UnknownTable]
        SET @BatchSize = @@rowcount
    END  
    

提交回复
热议问题