Tuesday, 17 January 2012

Sql TRANSACTION (Two Table Here how we Insert Data With the help of Transction and commit and RollBack)


ALTER procedure TrDemo
as
BEGIN


BEGIN TRY
BEGIN TRANSACTION
Insert into Demo1 Values(12,'RAMA')    
Insert into Demo3 Values(12,'RAMA','SAHID NAGAR')
print 'success'
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
PRINT 'ERROR'
END CATCH
END

Table Demo1

 

Table Demo3 
 

No comments:

Post a Comment