Transaction

  • So what is the difference with the following 2 statements given the fact the SQL Server insternally issues a transaction! I wish to know if the 1st option using Begin Tran Commit Tran is a waste of time.

    --1st option

    BEGIN TRAN

    INSERT TableName (A, B, C)

    VALUES 1, 2, 3

    COMMIT TRAN

    --2nd option

    INSERT TableName (A, B, C)

    VALUES 1, 2, 3


    Kindest Regards,

  • Yes, it is.

    _____________
    Code for TallyGenerator

  • Transaction boundaries are required when you are trying to do multiple inserts and based on the output of the first insert if you are doing a second insert and if you want the whole process be rolled back if any of the inserts fail. Otherwise there is no real requirement to use TRANSACTION Boundaries.

     

    Prasad Bhogadi
    www.inforaise.com

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

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