Re: begin and end transaction and transaction log



Kruton (wmlyerly@xxxxxxxxx) writes:
This is more of an architectural question about SQL Server. Can
someone please explain why when I perform a query such as the one
below that updates a table using begin and end transaction I am unable
to programmatically truncate the transaction log. The only way I have
found to truncate the transaction log is to stop and start the SQL
Server Service. Does this transaction use the tempdb? Is that why I
am unable to truncate the transaction log? Is there a better way to
do this?

Begin trans T1

Update sometable
Set random_row = 'blah'

End trans T1

Why would you truncate the transaction log in the first place?

If you run with full recovery and want to be table to restore to a point
in time, the you should backup your transaction log regularly.

If you don't care about the point-in-time restores but are content with
restoring from a full backup in case of a failure, you should set the
database in simple recovery.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: delete statement makes SQL Server hang
    ... But generally, a transaction won't be allowed to get more than say, several ... You can capture a lock escalation event with a profiler trace. ... transaction is committed and the transaction log is backed up. ... BG, SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: question regarding truncate operation
    ... Also I don't think there is anything in SQL Server which is not logged. ... log to a point in time before the transaction you did. ... >I read that truncate logs the deallocation of the data pages in>which the ...
    (microsoft.public.sqlserver.programming)
  • Re: Table Variable vs Temporary Table
    ... > logging to the transaction log for table variables). ... Pro SQL Server 2000 Database Design - ... >>> We have a query that declares a table variable, ...
    (microsoft.public.sqlserver.programming)
  • Re: urgent!!!
    ... One of us has an incomplete and/or inaccurate understanding of SQL Server in this context. ... > a BEGIN TRANSACTION & END TRANSACTION statement. ... > Deleting All Rows Using TRUNCATE TABLE ...
    (microsoft.public.sqlserver.server)
  • Re: Distribution Agent Startup Parameters
    ... have a manageable log size when a concurrent snapshot is applied in ... transaction log for large tables? ... the SQL2000 index creation logic in the distribution agent is not very ... having problems with the transaction log growing so large on the ...
    (microsoft.public.sqlserver.replication)