Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

truncate the transaction log

Status
Not open for further replies.

DirtyB

Programmer
Mar 13, 2001
159
US
is there a way to truncate the transaction log from transact code?
 
Using TSQL against a database called foo:

exec sp_dboption foo, 'trunc. log on chkpt', 'true'
checkpoint

This will truncate the inactive part of the transaction log once the checkpoint completes. However understand what you're doing before altering dboptions -- look in BOL under sp_dboption.

gm
 

You should be aware that truncating the log invalidates future transaction log backups until a full or differential backup is done.

In SQL 7 or 2000 use...

Backup Log With Truncate_only

Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Thanks guys...I just have a stored proc here that runs a TON of updates, and it always crashes because my transaction log gets full, so I wanted to be able to truncate it, periodically throughout the stored proc.

Thanks

Jason
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top