Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

@@TRANCOUNT is always incremented in a trigger

Jan 9 2012 1:24AM by Madhivanan   

The system variable @@TRANCOUNT is used to get the number of transactions that are active. Consider the following code

begin transaction
select 3
select @@TRANCOUNT 
commit transaction

The result of @@TRANCOUNT is 1. Consider the following code.

begin transaction
select 3
begin transaction
select 456
select @@TRANCOUNT 
commit transaction
commit transaction


The result of @@TRANCOUNT is 2.

So whenever there is a transaction the variable @@TRANCOUNT gets incrementedx by 1. In an Auto commit mode if you dont use a transaction, @@TRANCOUNT will never gets incremented. But this variable gets incremented always in a trigger.

This is what BOL specifies

@@TRANCOUNT is incremented by one when entering a trigger, even when in autocommit mode. (The system treats a trigger as an implied nested transaction.)

So you need to be aware of this and use @@TRANCOUNT effectively.

Tags: t-sql, sql_server, sqlserver, tsql, SQL Server, #SQL SERVER, @@Trancount,


Madhivanan
3 · 40% · 12958
2 Readers Liked this
Madhivanan Liked this on 1/9/2012 1:00:00 AM
Profile · Blog · Facebook · Twitter
Nakul Vachhrajani Liked this on 1/28/2012 4:46:00 AM
Profile · Blog · Facebook · Twitter
2
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • I had learnt this one the hard way, so thank-you for posting it, Madhivanan!

    commented on Jan 28 2012 4:49AM
    Nakul Vachhrajani
    4 · 36% · 11645

Your Comment


Sign Up or Login to post a comment.

"@@TRANCOUNT is always incremented in a trigger" rated 5 out of 5 by 2 readers
@@TRANCOUNT is always incremented in a trigger , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]