Thursday, December 4, 2008

TRANSACTION-COMMIT-ROLLBACK

BEGIN TRANSACTION


DECLARE @ERR INT



INSERT INTO USER_MASTER(USERNAME, PASSWORD) VALUES('Damerla','Damerla')



SET @ERR = @@Error



IF @ERR > 0



BEGIN



ROLLBACK TRANSACTION


PRINT 'ROLLBACK TRANSACTION'


END


ELSE


BEGIN


COMMIT TRANSACTION


PRINT 'COMMIT TRANSACTION'


END

No comments: