[dba-SQLServer] There are uncommitted transactions

David McAfee davidmcafee at gmail.com
Fri Jul 27 08:48:38 CDT 2012


It's acceptable.

I also do it like Francisco showed.

When i rollback i like to raise an error so the front end knows it was
rolled back and your error trapping can catch it and handle it gracefully.

Something like: raiserror('somethingHappened',17,1)

Sent from my Droid phone.
On Jul 27, 2012 5:37 AM, "jwcolby" <jwcolby at colbyconsulting.com> wrote:

> Is Tran an acceptable abbreviation or was that just an aircode thing?
>
> John W. Colby
> Colby Consulting
>
> Reality is what refuses to go away
> when you do not believe in it
>
> On 7/27/2012 8:03 AM, Francisco Tapia wrote:
>
>> I like to name my transactions
>> So when I write it I do it like this:
>>
>>  Begin Tran t1
>>> Do stuff
>>> Do more stuff
>>>
>> If some stuff begin
>>
>>> Commit Tran t1
>>>
>> End
>> Else begin
>> Rollback tran t1
>> End
>>
>> In this way I know that what I've wrapped up is actually committed (or
>> rolled back when some criteria is not met.)
>>
>>
>>
>> Sent from my mobile device
>>
>> On Jul 27, 2012, at 4:26 AM, jwcolby <jwcolby at colbyconsulting.com> wrote:
>>
>>  SQL Server appears to be hanging for a batch job.  I am wrapping a group
>>> of processes in a transaction.  It processes dozens of these things then...
>>> suddenly it stops.  I cannot get it to start again.  If i exit SSMS it pops
>>> up a message:
>>>
>>> "there are uncommitted transactions.  Do you wish to commit these
>>> transactions before closing the window?"
>>>
>>> I say yes, it performs a commit, and I can go right back in to SSMS and
>>> start up this process and it takes off and runs.
>>>
>>> So what is SSMS doing to commit these "uncommitted transactions"?  And
>>> can I do that same thing in TSQL?
>>>
>>> I wrap the transaction group in a
>>>
>>> Begin Transaction
>>> Do stuff
>>> Do more stuff
>>> Commit
>>>
>>> What more is there?
>>>
>>> --
>>> John W. Colby
>>> Colby Consulting
>>>
>>> Reality is what refuses to go away
>>> when you do not believe in it
>>>
>>> ______________________________**_________________
>>> dba-SQLServer mailing list
>>> dba-SQLServer@**databaseadvisors.com<dba-SQLServer at databaseadvisors.com>
>>> http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver<http://databaseadvisors.com/mailman/listinfo/dba-sqlserver>
>>> http://www.databaseadvisors.**com <http://www.databaseadvisors.com>
>>>
>>>  ______________________________**_________________
>> dba-SQLServer mailing list
>> dba-SQLServer@**databaseadvisors.com <dba-SQLServer at databaseadvisors.com>
>> http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver<http://databaseadvisors.com/mailman/listinfo/dba-sqlserver>
>> http://www.databaseadvisors.**com <http://www.databaseadvisors.com>
>>
>>
>>
> ______________________________**_________________
> dba-SQLServer mailing list
> dba-SQLServer@**databaseadvisors.com <dba-SQLServer at databaseadvisors.com>
> http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver<http://databaseadvisors.com/mailman/listinfo/dba-sqlserver>
> http://www.databaseadvisors.**com <http://www.databaseadvisors.com>
>
>


More information about the dba-SQLServer mailing list