Skip to content

Instantly share code, notes, and snippets.

@ccjeng
Created April 19, 2013 03:02
Show Gist options
  • Save ccjeng/5417820 to your computer and use it in GitHub Desktop.
Save ccjeng/5417820 to your computer and use it in GitHub Desktop.
SQL server - Purge transaction log
USE DatabaseName
GO
DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment