Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

There should be a way to tell whether I am in a distributed transaction

If you try to issue SAVE TRANSACTION inside a distributed transaction, you get an error message that it is not supported. You may have written a stored procedure which uses a savepoint and it works well. But later someone decides to call your stored procedure in a distributed transaction from another instance, but this fails because of the savepoint. You may be prepared to give up the savepoint in the case you are in a distributed transaction. But there is no way you can tell whether you are a in a distributed transaction. (Or more precisely there is no way you can do this under the context of a user of regular permissions. That is, the DMVs that have this information are not sufficient.)

It seems that a new system function would be the best way to implement this.

1 vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Erland Sommarskog shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base