SQL Database Concepts Question:

Download Job Interview Questions and Answers PDF

Tell me the phases a transaction has to undergo?

Basic SQL Server Interview Question
Basic SQL Server Interview Question

Answer:

The several phases a transaction has to go through are listed here. Database is in a consistent state when the transaction is about to start.

1. The transaction starts processing explicitly with the BEGIN TRANSACTION statement.
2. Record is written to the log when the transaction generates the first log record for data modification.
3. Modification starts one table at time. Here database is in inconsistent state.
4. When all of the modifications have completed successfully and the database is once again consistent, the application commits the transaction.
5. If some error it undoes (or rolls back) all of the data modifications. This process returns the database to the point of consistency it was at before the transaction started.

Download Basic SQL Server Interview Questions And Answers PDF

Previous QuestionNext Question
Do you know what is Similarity and Difference between Truncate and Delete in SQL?Do you know what is Normalization of database? What are its benefits?