Wednesday, February 21, 2007

SQL 2005 Dump Transaction Log

I always forget how to dump a transaction log on SQL server. Here is the answer:-

BACKUP LOG {DatabaseName} WITH NO_LOG
GO
DBCC SHRINKDATABASE ({DatabaseName}, 0)
GO
DBCC SQLPERF(logspace)
GO