﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2012 / SQL 2012 - General  / Committed Transaction, not really committed? / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 00:14:50 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>Invalid object is not a run-time error, it's thrown in the parse/bind/optimise phase. Try catch catches run-time errors.</description><pubDate>Fri, 22 Feb 2013 09:16:50 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>I get it, it's because this type of error isn't caught by try/catch statements.</description><pubDate>Fri, 22 Feb 2013 08:38:00 GMT</pubDate><dc:creator>thisted</dc:creator></item><item><title>RE: Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>If the Rollback transaction is within the Catch Statement, why doesn't the transaction end?Here's an example script I used for testing this out just now.  The table I'm trying to update exists in a different database, so it fails[code="other"]USE [MASTER]BEGIN TRY       BEGIN TRANSACTION			Update DBAEmails Set Email = 'thisted@gmail.com' where ID = 2		COMMIT TRANSACTIONEND TRYBEGIN Catch       print 'Failure to Update Email'       RollBack TransactionEnd Catch[/code]I get the error messageMsg 208, Level 16, State 1, Line 4Invalid object name 'DBAEmails'.But the Rollback doesn't happen?What you mention in your PS is true.  We need to work out a better solution.</description><pubDate>Fri, 22 Feb 2013 08:24:04 GMT</pubDate><dc:creator>thisted</dc:creator></item><item><title>RE: Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>Yup. You began the transaction twice and committed it once, thereby leaving the transaction open and all locks still held.If you'd checked @@TranCount it would have shown 1, and DBCC OpenTran would have shown your change (assuming that it was the oldest open transaction).p.s. Ad-hoc, unchecked changes to a production database? That's just asking for this kind of problem and worse.</description><pubDate>Fri, 22 Feb 2013 08:08:07 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>I missed the Rollback in my psudocode.  It does exist in the actual code within the Begin/End Catch statement.I think you're right about the nested transactions though...I originally ran the script against master :ermm:Got an error that the tables it was attempting to update didn't existThen switched the database to the correct database, and ran it again.Does that make sense for what I'm seeing?</description><pubDate>Fri, 22 Feb 2013 07:50:13 GMT</pubDate><dc:creator>thisted</dc:creator></item><item><title>RE: Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>Possibility 1: Nested Transactions.Something like this:[code="sql"]Begin transaction-- do some stuffBegin transaction-- do some more stuffCommit transaction[/code]That transaction is still open. The commit did nothing other than decrement the open transaction count, because there was more than one Begin TranPossibility 2: Do Work threw an error. You don't have a rollback in your catch block, so the commit never occurred and hence the transaction was left open.</description><pubDate>Fri, 22 Feb 2013 07:45:35 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>Committed Transaction, not really committed?</title><link>http://www.sqlservercentral.com/Forums/Topic1423058-2799-1.aspx</link><description>I recently executed a script in SSMS.  The script contained the logic below[code="other"]Begin Try  Begin Tran    DO WORK  Commit TranEnd TryBegin CATCH SEND ERROREND CATCH[/code]The Script completed sub-second.  I got the green little checkmark that said "Query executed Successfully" at the bottom of my query &amp;#119;indow.10 minutes later I got a call that performance on the database was "SLOW"I ran SP_WHOISACTIVE and found that my session was still active, even though SSMS made it look like everything completed successfully.  I started seeing this (3 times for me personally, a few times for developers as well) since I upgraded to SSMS 2012.  Has anyone else seen this.  Is it a client issue?  Is it a server issue?  Is this the result of normal locking from other processes?</description><pubDate>Fri, 22 Feb 2013 07:34:28 GMT</pubDate><dc:creator>thisted</dc:creator></item></channel></rss>