Rollback transaction not log | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Rollback transaction not log

I have a client who wants to be able to achieve the following:
write an entry into log about the following event:
do the event
But if the event fails rollback the transaction, and keep the log. The events are usually truncating tables. I’m sure somebody can help me.
I’m not sure if I understand you.
TRUNCATE TABLE is minimally logged. Only the deallocation of the data pages is logged. TRUNCATE can be used inside a transaction, thus can be rolled back. What does he actually now want to keep in case of an error? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

I think it will have same level of rollback facility when you’re using TRUNCATE TABLE as it will wipe out the table completely, so use it carefully. As Frank asked please explain the exact requirement. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
What kind of log you are talking about? Transaction log, error log file or table where you intend to log specific events?
Thank you all for bearing with me. There’s a transaction with many steps. We want to log into a file each of the steps and where it fails, then roll back the transaction. Presently we’re rolling back the transaction and the entry into the file. Does this help me help you help me?
Check this BLOGhttp://codebetter.com/blogs/darrell.norton/archive/2003/12/24/4921.aspx link for more information on nested transactions. HTH Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>