How to axe your transaction log
Posted by
Brad Wood
Sep 06, 2008 00:36:00 UTC
If you are using MS SQL Server and ever want to just obliterate your transaction log, you can use the following SQL (where your database name is "foo"):
BACKUP LOG foo WITH TRUNCATE_ONLY
DBCC SHRINKFILE(foo_log,2)
Don't ever do this to a database you care about like, say, production. I wanted this because I am screwing around creating rainbow tables of SHA-1 hashes. The Cartesian product of joining a table to itself on 1=1 is very handy for producing all possible combinations of a set of characters. Inserting a few million records can put a lot of crap in your transaction log though.