Commit vs Commit Transaction

  • Hi

    im looking at a piece of code that randomly fails

    it goes along the line of something like

    While Something

    BEGIN

    Begin Trasnaction

    Insert Into Table

    Commit

    END

    Firstly i have added the rollback on the @@ERROR check , but im wodering if there is any differance between calling Commit and Commit Transction

    Regards

    Clayton.

  • No. The word TRANSACTION is optional after COMMIT or ROLLBACK.

    Don't add @@error, add a try-catch construct.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks alot

Viewing 3 posts - 1 through 3 (of 3 total)

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