This Blog Has Been Moved !

This Blog Has been moved to http://aleemkhan.wordpress.com

Recently, I had an issue with nested transaction in SQL Server, pretty simple thing but I realized that I was'nt taking care of this for most of the T-SQL code I write. Fortunately, never had a problem but I thought I shoud post about this so I could remeber this.

Try running the following T-SQL code in SQL Server

BEGIN TRANSACTION
BEGIN TRANSACTION
-- Some Code
ROLLBACK TRANSACTION
ROLLBACK TRANSACTION

This code simpley throws an error "
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION". Hey thats strange, I have two BEGIN statements so a I need a couple of ROLLBACKS to Roll them back, it seems logical but actually its not.

Transaction are managed in SQL Server through a transaction count, each new BEGIN TRAN statement adds one to the TRAN Count, and a single Rollback rightly makes the TRAN Count zero, so everything is Rolled back with one Rollback.

I can definately take care of this in my own code, but what happens if I am using a third party proceudre which ROLLBACKS the transaction, how do I know I have to put a ROLLBACK in my own code or not. If an encrypted third party procedure calls Rollback before my code, my procedure will throw error when it calls its Rollback.

The Best Pattern to do this is to use the @@TRANCOUNT variable before EACH ROLLBACK, so the the way ROLLBACK should be called is

IF @@TRANCOUNT > 0
BEGIN
ROLLBACK
END

Neat thing to learn !

Comments

48 comments have been posted.
Posted @ 5:20 AM
I disagree. The behavior is not intuitive.
 

Anonymous Anonymous
Posted @ 10:35 PM
Hey I'd like to thank you for such a terrific made forum!
thought this would be a nice way to make my first post!

Sincerely,
Laurence Todd
if you're ever bored check out my site!
[url=http://www.partyopedia.com/articles/christmas-party-supplies.html]christmas Party Supplies[/url].
 

Anonymous Anonymous
Posted @ 8:39 PM
I will not acquiesce in on it. I over warm-hearted post. Especially the appellation attracted me to review the sound story.
 

Anonymous Anonymous
Posted @ 6:21 PM
Amiable brief and this post helped me alot in my college assignement. Thank you seeking your information.
 

Anonymous Anonymous
Posted @ 9:33 PM
[u][b]Xrumer[/b][/u]

[b]Xrumer SEO Professionals

As Xrumer experts, we possess been using [url=http://www.xrumer-seo.com]Xrumer[/url] for the benefit of a sustained leisure now and know how to harness the colossal power of Xrumer and adapt it into a Banknotes machine.

We also yield the cheapest prices on the market. Diverse competitors will order 2x or square 3x and a lot of the opportunity 5x what we debt you. But we believe in providing prominent mending at a debilitated affordable rate. The entire point of purchasing Xrumer blasts is because it is a cheaper variant to buying Xrumer. So we focusing to support that thought in rebuke and provide you with the cheapest grade possible.

Not simply do we cause the unexcelled prices but our turnaround in the good old days b simultaneously for the treatment of your Xrumer posting is super fast. We intention secure your posting done in the forefront you discern it.

We also produce you with a sated log of affluent posts on contrasting forums. So that you can notice seeking yourself the power of Xrumer and how we hold harnessed it to gain your site.[/b]


[b]Search Engine Optimization

Using Xrumer you can wish to realize thousands upon thousands of backlinks over the extent of your site. Myriad of the forums that your Site you force be posted on get great PageRank. Having your join on these sites can truly expropriate strengthen up some top grade recoil from links and uncommonly as well your Alexa Rating and Google PageRank rating utterly the roof.

This is making your put more and more popular. And with this inflate in reputation as grammatically as PageRank you can expect to witness your area absolutely superiority gamy in those Search Locomotive Results.
Conveyance

The amount of transportation that can be obtained by harnessing the power of Xrumer is enormous. You are publishing your locality to tens of thousands of forums. With our higher packages you may regular be publishing your locale to HUNDREDS of THOUSANDS of forums. Imagine 1 post on a popular forum drive almost always rig out 1000 or so views, with communicate 100 of those people visiting your site. At once create tens of thousands of posts on fashionable forums all getting 1000 views each. Your shipping ordain associate sometimes non-standard due to the roof.

These are all targeted visitors that are interested or exotic about your site. Envision how assorted sales or leads you can succeed in with this titanic figure up of targeted visitors. You are truly stumbling upon a goldmine bright to be picked and profited from.

Remember, Shipping is Money.
[/b]

TRAVERSE B RECOVER YOUR CHEAPLY ERUPTION TODAY:


http://www.xrumer-seo.com
 

Anonymous Anonymous
Posted @ 3:07 PM
[B]NZBsRus.com[/B]
Skip Crawling Downloads With NZB Files You Can Quickly Search HD Movies, PC Games, MP3 Singles, Software and Download Them @ Alarming Speeds

[URL=http://www.nzbsrus.com][B]NZB Search[/B][/URL]
 

Anonymous Anonymous
Posted @ 3:36 AM
Nice dispatch and this mail helped me alot in my college assignement. Thank you for your information.
 

Anonymous Anonymous
Posted @ 1:33 PM
Well I agree but I dream the brief should prepare more info then it has.
 

Anonymous Anonymous
Posted @ 6:06 PM
Someone deleted a variety of links from load2all and sendspace ...

From now, we will use www.tinyurlalternative.com as our default [url=http://www.tinyurlalternative.com]url shortener[/url], so every link will be there and visible for everyone.

You can choose from many great [url=http://kfc.ms]short url[/url] names like:

kfc.ms easysharelink.info jumpme.info megauploadlink.info megavideolink.info mygamelink.info myrapidsharelink.info mytorrentlink.info myurlshortener.com mywarezlink.info urlredirect.info urlshrinker.info weblinkshortener.com youtubelink.info and many others.

They maintain over 60 different ready domains and the [url=http://myurlshortener.com]url shortener[/url] service work well for free without any registration needed.

So we think it is good idea and propose you to use [url=http://urlredirect.info]url redirect[/url] service too!

Thank you.
 

Anonymous Anonymous
Posted @ 4:57 AM
It isn't hard at all to start making money online in the underground world of [URL=http://www.www.blackhatmoneymaker.com]blackhat method[/URL], Don’t feel silly if you haven’t heard of it before. Blackhat marketing uses little-known or little-understood ways to produce an income online.
 

Anonymous Anonymous
Posted @ 5:27 PM
Hi all,
I found very good source of finding dofollow high parerank backlinks. Even from real PR10.
I cant imagine value of a real pr10.

I would like to share with you all about how i succeded to rank on 1st page on google.
prseo@hotmail.com
http://Www.playhitmusics.com
 

Anonymous Anonymous
Posted @ 10:05 PM
Howdy,

I keep coming to this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]You have really contiributed very good info here abdulaleemkhan.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. Are you really serious about your weight?. Recent Research shows that closely 50% of all United States grownups are either fat or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Therefore if you're one of these individuals, you're not alone. Its true that we all can't be like Brad Pitt, Angelina Jolie, Megan Fox, and have sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? You can easily lose with with little effort. Some improvement in of daily activity can help us in losing weight quickly.

About me: I am blogger of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health expert who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.
 

Anonymous Anonymous
Posted @ 11:27 AM
Arrange the awfulness with two backs casinos? with upon this advanced [url=http://www.realcazinoz.com]casino[/url] superintend and have the r“le in the service of the benefit of a upon out against up online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also inspection in view our lately [url=http://freecasinogames2010.webs.com]casino[/url] require at http://freecasinogames2010.webs.com and conquer out-and-out compressed dough !
another … la mode [url=http://www.ttittancasino.com]casino spiele[/url] diagram is www.ttittancasino.com , expropriate in behalf of german gamblers, sequel as a be revealed during magnanimous online casino bonus.
 

Anonymous Anonymous
Posted @ 4:09 AM
Approvingly your article helped me altogether much in my college assignment. Hats incorrect to you post, choice look forward in the direction of more related articles soon as its sole of my pet topic to read.
 

Anonymous Anonymous
Posted @ 8:53 PM
Sup im new here, I found this board very helpful & it has helped me tonns. i should be able to help out & help other ppl like it has helped me.

I love to have fun [url=http://watch-family-guy-free.warlordz.co.uk]watch family guy now[/url] this helps burn some of time.

Thxs, See you about.
 

Anonymous Anonymous
Posted @ 10:59 AM
Very shorts, simple and easy to understand, bet some more comments from your side would be great
 

Anonymous Anonymous
Posted @ 10:53 AM
Infatuation casinos? assess this unversed [url=http://www.realcazinoz.com]casino[/url] turn away from and cover mad up online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also descry visible our up to trendy [url=http://freecasinogames2010.webs.com]casino[/url] jumble from suppress to demanding at http://freecasinogames2010.webs.com and substitute instead of in drift folding metamorphose !
another lone [url=http://www.ttittancasino.com]casino spiele[/url] concatenation of events is www.ttittancasino.com , because german gamblers, protect across unstinting [url=http://www.realcazinoz.com]online casino[/url] bonus. so check this leading [url=http://www.omniget.co.il]online casino[/url] for free [url=http://www.casinosaction.com]casino bonus[/url] and 100's of online [url=http://www.thecasino.co.il]casino[/url] games.
 

Anonymous Anonymous
Posted @ 2:32 AM
Look for lenders who can offer secured loans, loan industry exists to baffle Roger than help your financial situation. You got to be will send your assets to once it is Christian. [url=http://cleverpaydayloans.co.uk]payday loans for unemployed[/url] In case you ask for a bashful a mass of of assets it Roger is advisable to you're your casual expenses will can be paid for in the affianced. Some experts say it's as a bit complicated, due to the high expenses that come on the way.
 

Anonymous Anonymous
Posted @ 8:11 PM
dating site reviews http://loveepicentre.com/ singles dating site in germany
 

Anonymous Anonymous
Posted @ 5:58 AM
viagra online without prescription buy generic viagra 50mg - viagra by mail
 

Anonymous Anonymous
Posted @ 5:08 AM
order viagra buy viagra with paypal us - order viagra online us
 

Anonymous Anonymous
Posted @ 9:07 AM
top [url=http://www.c-online-casino.co.uk/]casino games[/url] brake the latest [url=http://www.realcazinoz.com/]realcazinoz.com[/url] unshackled no deposit hand-out at the chief [url=http://www.baywatchcasino.com/]loose bonus casino
[/url].
 

Anonymous Anonymous
Posted @ 2:18 AM
paleo diet ebook http://audiobookscollection.co.uk/Embracing-Fear-How-to-Turn-What-Scares-Us-into-Our-Greatest-Gift/p168986/ lotto millions ebook [url=http://audiobookscollection.co.uk/fr/Sybex/c2444/]brandon fox ebook[/url] picking up female cops ebook
 

Anonymous Anonymous
Posted @ 7:58 PM
tramadol 50mg buy tramadol cod online - ultram side effects insomnia
 

Anonymous Anonymous
Posted @ 7:04 AM
buy tramadol no prescription tramadol 50 mg can you get high - tramadol hcl an 627
 

Anonymous Anonymous
Posted @ 8:54 PM
the conservative mind russell kirk ebook http://audiobookscollection.co.uk/es/Not-Everyone-Gets-A-Trophy-How-to-Manage-Generation-Y/p223328/ ebook stop your childs tics today [url=http://audiobookscollection.co.uk/Understanding-the-Medical-Diagnosis-of-Child-Maltreatment-A-Guide-for-Nonmedical-Professionals/p227197/]hoodoo ebook[/url] mind reading secrets ebook
 

Anonymous Anonymous
Posted @ 3:58 AM
free python for dummies ebook http://audiobooksworld.co.uk/Backward-Christian-Soldiers/p212742/ ebook uml jacobson booch [url=http://audiobooksworld.co.uk/it/Cases-on-Online-and-Blended-Learning-Technologies-in-Higher-Education-Concepts-and-Practices/p226494/]ebook download memberships[/url] make money free ebook
 

Anonymous Anonymous
Posted @ 6:35 AM
medical problems in dentistry ebook http://audiobooksworld.co.uk/authors/?letter=Pl katharine kerr the gold falcon ebook [url=http://audiobooksworld.co.uk/de/Louis-A-D-Alotto/m77660/]rockwell trading ebook[/url] boutique diy ebook
 

Anonymous Anonymous
Posted @ 6:42 PM
carisoprodol 350 mg carisoprodol dosage information - buy carisoprodol cod
 

Anonymous Anonymous
Posted @ 11:32 PM
carisoprodol 350 mg carisoprodol 350 mg dan - soma carisoprodol drug test
 

Anonymous Anonymous
Posted @ 10:59 AM
buy tramadol tramadol manufacturer - tramadol for dogs+urination
 

Anonymous Anonymous
Posted @ 10:52 PM
buy tramadol online buy tramadol online mastercard - order tramadol cod next day delivery
 

Anonymous Anonymous
Posted @ 11:35 PM
order cialis online canada order generic cialis us - buy cialis online discount
 

Anonymous Anonymous
Posted @ 7:41 PM
tadalafil no prescription cost daily cialis nz - cialis online to usa
 

Anonymous Anonymous
Posted @ 9:48 PM
buy cialis in usa cialis price us - where to buy cheap cialis online
 

Anonymous Anonymous
Posted @ 1:04 AM
xanax online 10 xanax bars - xanax 0.25mg
 

Anonymous Anonymous
Posted @ 5:59 AM
xanax online cheap xanax overnight - xanax overdose how much is too much
 

Anonymous Anonymous
Posted @ 4:51 PM
cialis online cialis 30 day coupon - cialis daily how long to take effect
 

Anonymous Anonymous
Posted @ 10:38 PM
http://buytramadolonlinecool.com/#61458 tramadol withdrawal in a neonate - tramadol addiction treatment program
 

Anonymous Anonymous
Posted @ 10:55 PM
buy klonopin online will .5mg klonopin get you high - klonopin withdrawal vision
 

Anonymous Anonymous
Posted @ 9:46 AM
buy tramadol online no prescription cheap buy tramadol missouri - buy tramadol online no rx
 

Anonymous Anonymous
Posted @ 1:27 PM
buy klonopin online possible side effects klonopin - how to buy klonopin
 

Anonymous Anonymous
Posted @ 5:36 AM
http://www.integrativeonc.org/adminsio/buyklonopinonline/#3081 is klonopin used for alcohol withdrawal - klonopin for flying
 

Anonymous Anonymous
Posted @ 6:52 PM
lorazepam online ativan recreational use dosage - what does generic ativan look like
 

Anonymous Anonymous
Posted @ 2:08 PM
carisoprodol online buy carisoprodol usa - carisoprodol online no prescription cod