April 2, 2012 at 12:51 am
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
April 2, 2012 at 2:23 am
This was removed by the editor as SPAM
April 2, 2012 at 2:27 am
This was removed by the editor as SPAM
April 2, 2012 at 9:57 pm
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
April 2, 2012 at 10:17 pm
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