SQL Server logs in a circular fashion to its transaction log files. To shrink a transaction log file it is first necessary to backup the log.
The following script backs the log up, throwing away the backup in the process and then shrinks the files in the database. Make sure you have a full backup of the database before running.
declare @db varchar(50)
set @db = DB_NAME()
backup log @db with truncate_only
dbcc shrinkdatabase (@db, truncateonly)
Tags: Microsoft SQL Server