Answers

Question and Answer:

  Home  MS SQL Server Transaction

⟩ Do you know nested transaction?

A nested transaction is one in which a new transaction is started by an instruction that is already inside another transaction. This new transaction is said to be nested. The isolation property of transaction is obeyed here because the changes made by the nested transaction are not seen or interrupted by the host transaction.

BEGIN TRANSACTION trans_1

INSERT INTO TestTrans1 VALUES (1,’mark’)

COMMIT TRANSACTION trans_1;

GO

/* Start a transaction and execute trans_1. */

BEGIN TRANSACTION trans_2;

GO

EXEC trans_1 1, 'aaa'; //execute some procedure

GO

ROLLBACK TRANSACTION trans_2;

GO

EXECUTE TransProc 3,'bbb';

GO

 175 views

More Questions for you: