Scenario: While executing a complex SQL transaction, an error occurs, and you need to roll back the changes made so far. What steps should you follow to perform a proper rollback?
- Delete the affected rows manually to revert the changes.
- Execute a new COMMIT TRANSACTION statement to finalize the changes.
- Restart the SQL Server service to reset the transaction log.
- Use the ROLLBACK TRANSACTION statement to undo the changes.
Manually deleting affected rows is not a recommended approach as it might lead to data inconsistency. Restarting the SQL Server service is a drastic measure and may disrupt other ongoing operations. Executing a new COMMIT TRANSACTION statement would finalize the changes, which is contrary to the goal of rolling back. The correct step is to use the ROLLBACK TRANSACTION statement to undo the changes made so far and maintain data integrity.
Loading...
Related Quiz
- In CI/CD, what is the purpose of a "build pipeline" in relation to database testing?
- Which SQL statement is used to retrieve data from a database?
- What is the primary objective of data migration testing?
- Test scripts in database testing are typically written using _______ language.
- Which testing technique is used to evaluate the performance of a database under heavy loads?