Open SQL Server Management Studio:
Truncate by clicking:
- Don’t do this on a live environment, but to ensure you shrink your dev db as much as you can:
- Right-click the database, choose properties, then options.
- Make sure “Recovery model” is set to “Simple”, not “Full”
- Click Ok
- Right-click the database again, choose tasks -> shrink files
- Change file type to “log”
- Click ok.
Truncate with Script:
Alternatively, the SQL to do it (Code tested and working on SQL SERVER 2008 R2):
ALTER DATABASE mydatabase SET RECOVERY SIMPLE
use mydatabase
DBCC SHRINKFILE (mydatabase_Log, 1)
Ref: http://msdn.microsoft.com/en-us/library/ms189493.aspx
Resources:
https://stackoverflow.com/questions/40402/what-is-the-command-to-truncate-a-sql-server-log-file
– http://theitbros.com/truncate-sql-server-2012-transaction-logs/