Thursday, 29 June 2017

Blog No Baap

SQL Server Interview: If Outer transaction ROLLBACK, what happens to Inner transaction

I hope you know that we can create nested transactions in SQL Server. If you are giving a SQL Server developer interview, an interviewer may ask a question like If Outer transaction ROLLBACK, what happens to an Inner transaction in SQL Server.
The interviewer can also write code in paper and can ask a developer to solve it.
You can find the answer in below demonstration so test it yourself.
Create a sample table:
Open outer and inner transaction and insert few sample records:
Check the count of your table:
Now, Rollback your Outer transactions:
Now, Check the count of your table:
Which is 0 now. Although you committed inner transaction for those 1000 records, outer transaction was not committed, so it rollbacked all transactions.

Blog No Baap

About Blog No Baap -

Since 2016 BlogNoBaap has been bringing you the very best in all types of web resources. Posted daily, and delivered straight to your inbox each morning.

Subscribe to this Blog via Email :