What happens to a variable after COMMIT or ROLLBACK

  • Thanks to OP for submitting the question. Still scratching my head about it being worth two points. But, I'll take them.

    They put me that much closer to having enough points to retire. 😉

    [font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
    Connect to me on LinkedIn

  • raulggonzalez (10/7/2013)

    Thanks for the question!

    It might be good also to point that table variables are not affected either by transaction rollbacks.

    As per BOL

    Because table variables have limited scope and are not part of the persistent database, they are not affected by transaction rollbacks.



    That's why I got this correct, my quick mental reasoning was... "If table variables aren't affected, why would normal variables be?"

    🙂 I'll take +2 for this... you made me have to reason, if only a very itty bitty bit too early in the morning.

    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • Jamsheer (10/7/2013)

    PRR.DB (10/6/2013)

    Mr. Kapsicum (10/6/2013)

    Nice and Easy Question to start the week.



    +3 🙂


    Jason...AKA CirqueDeSQLeil
    I have given a name to my pain...MCM SQL Server, MVP
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Very nice - thank you, Ashish!

  • Nice and easy start to the week .. nice question thanks.

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • Thanks for an easy 2 pointer!

  • I've seen a couple responses referencing table variables as not being affected by begin/save/commit tran statements. Would it be a safer lesson to assert NO local variables are affected by those statements because they are solely intended to effect the persistence layer?

  • nice question thank's

Viewing 8 posts - 16 through 22 (of 22 total)

You must be logged in to reply to this topic. Login to reply