Sql server Transactions are Atomic .Looking for a Live Example

  • hi everyone,

    I have tried the below Sql as a try out to Confirm and see if Transaction in Sqlserver are atomic.But i dont know, i couldnt gain atomicity. Kindly point me and tell me where i am going wrong.

    In the below t-sql. i am update amt of table t1 to 75 and after that if you abruptly stop the execution, the updated value persists . it should be rollbacked to the old value right?

    Any help would be appreciated

    create table tranchk(id int,amt int)

    BEGIN Tran t2

    insert into tranchk(id,amt)

    values(1,100)

    Update t

    set amt=75 FROM tranchk t

    WHERE id=1

    WAITFOR DELAY '00:03:00'

    COMMIT TRAN t2

    regards

    chaithanya M

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • Hi,

    What if the session is abruptly closed. For example in the example provided by me, i have WAITFOR CLause to delay for 3 mins, at sometime before 3 mins, if i close the session abruptly , The transaction should get rollback right, but it is not getting rollback..What is happening here.

    Regards

    Chaithanya M

  • When you click the close button, a dialogue box appears saying

    "There are uncommitted transactions. Do you wish to commit these transactions before closing the window?".

    I guess you clicked "Yes" button.

Viewing 5 posts - 1 through 4 (of 4 total)

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