title: Using SAVE TRANSACTION SavePointName in a Stored Procedure
body: <p>It is unclear to me if I need to used a different save point names for each SP I use <code>SAVE TRANSACTION</code>.</p>
  
  <p>Could I always use e.g. <code>SAVE TRANSACTION ProcedureSavePoint</code> and <code>ROLLBACK TRANSACTION ProcedureSavePoint</code> even if a higher level transaction used the same save point name?</p>
  
  <p>My SP(s) signature is as follow:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[usp_MyTask]()
  AS
  BEGIN
      DECLARE @iReturn int = 0
  
      DECLARE @tranCount int = @@TRANCOUNT;
      IF @tranCount &gt; 0
          SAVE TRANSACTION ProcSavePoint;
      ELSE
          BEGIN TRAN    
      ...
  
      IF &lt;some condition&gt;
      BEGIN
          @iReturn = 1
          GOTO Undo
      END
  
      ...
  
      IF @tranCount = 0 
          COMMIT TRAN 
      RETURN
  
  Undo:
      IF @tranCount = 0 -- transaction started in procedure. Roll back complete transaction.
          ROLLBACK TRAN;
      ELSE
          IF XACT_STATE() &lt;&gt; -1 ROLLBACK TRANSACTION ProcSavePoint;
  
      RETURN @iReturn
  END
  </code></pre>
  
  <p>Hope my question is clear.</p>