How to delete SQL transaction logs with a query.

June 16, 2011 - 11:18

When using a Microsoft SQL server regularly, you may find that the transaction log can get quite large. If an import is ran every day then the database log file can quickly grow to several gigabytes.

Although the transaction log may sometimes be useful. Most often is the case that you are probably already performing daily backups, and in the event of a failure would just perform a complete restore of the database.

The sql query shown below dumps these logs and will reduce the size of your database.

dump transaction DatabaseName with no_log

--Replace the word DatabaseName with your Database Name


After you have deleted the logs, you may wish to run a shrink on the database to remove any unsused space.



© 2011 simplevb.net