Delete SQL Server 2005 records without logging
sql-server, sql-server-2005
Solution
It's easy:
DECLARE @BatchSize INT
SET @BatchSize = 100000
WHILE @BatchSize <> 0
BEGIN
DELETE TOP (@BatchSize)
FROM [dbo].[UnknownTable]
SET @BatchSize = @@rowcount
END
Problem
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 needed again. Currently the various deletes take too much of time. Are there any other options to improve performance of delete statements? I can not use truncate since there is a where clause needed.