Please Help Me With SavePoint

Jan 15, 2008

Hi,

I'm studying MS SQL 2000, and i see SAVE POINT statement. I try it:
===================================
BEGIN TRANSACTION

UPDATE emp SET sal = 2000 WHERE ename = 'BLAKE'
SAVE TRANSACTION SAVETRANS_1

UPDATE emp SET sal = 1500 WHERE ename = 'CLARK'
SAVE TRANSACTION SAVETRANS_2

SELECT SUM(sal) FROM emp

ROLLBACK TRANSACTION SAVETRANS_2

UPDATE emp SET sal = 1200 WHERE ename = 'CLARK'

COMMIT TRANSACTION

===================================
But it always rollback to SAVETRANS_1. I do not know how to ? Please help me. Thanks you very much.

Best gurad,
HaiNguyen - Sorimachi Viet Nam - lh9911051@yahoo.com

View 3 Replies


ADVERTISEMENT

Need Some Help On Savepoint,Commit And Rollback

Oct 9, 2000

Hi,
I have a procedure of 6500 lines in which i have given a save point at the beginning of the procedure. And am storing the error number in a variable through out the procedure using select of @@error. And at the end if my @error_number is not zero then am rolling back the tranasction else commit the transaction.

Its giving me the error
Msg 266, Level 16, State 2, Line 5437
Transaction count after execute indicates that a commit or rollback
transaction statement is missing. Previous count = 0, Current count = 1.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved