Truncate log and shrink database SQL 2005
Use the following statements to truncate the logs and shrink the database files.
declare @db varchar(100) set @db = 'EnterDatabaseNameHere' -- note: This statement is no longer supported in SQL 2008 BACKUP LOG @db with TRUNCATE_ONLY -- note: this statement will break transaction log shipping. -- note: Rearranges data arranged in file. Moves data at end to unallocated pages in front of file. DBCC SHRINKDATABASE (@db, notruncate) -- note: Release all free space at the end of the file DBCC SHRINKDATABASE (@db, truncateonly)