Help with Transaction

Results 1 to 2 of 2

Thread: Help with Transaction

  1. #1
    Join Date
    Dec 1969

    Default Help with Transaction

    The following stored procedure was written to commit jobs..I want it not proceed if any part of the transaction fails. <BR><BR><BR>Begin Tran<BR> INSERT INTO T_S1_Status_Current<BR> SELECT * FROM T_S1_Status_Current_Exceptions WHERE recordid = @recordid<BR> <BR> DELETE FROM T_S1_Status_Current_Exceptions<BR> WHERE recordid = @recordid<BR> <BR> UPDATE T_S1_Status_Current<BR> SET Exception_Flag = NULL<BR> WHERE recordid = @recordID<BR>Commit Tran<BR>

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Help with Transaction

    the best way<BR><BR>if @@error &#062; 0 <BR>begin<BR>if @@trancount &#062; 0<BR>commit tran<BR>end<BR>else<BR>begin<BR>if @@trancount &#062; 0<BR>rollback tran<BR>end<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts