Nik's Technology Blog

Travels through programming, networks, and computers

Truncating and Shrinking a SQL Server logfile

It's such a pain when a SQL Server log file runs away with it's self on a development machine. I always forget the T-SQL to truncate and shrink the log file, so I thought I'd post it here for future reference.

BACKUP LOG <database name> WITH TRUNCATE_ONLY

DBCC SHRINKFILE ('<datbase file minus extension>',1)