Which action should you take?
Correct Answer for the following Question is given below
You have a database that resides on an instance of SQL Server 2008. You are creating a stored procedure that will update a critical table. The stored procedure reads data in the Master table, performs aggregation calculations on the table’s data, and populates a table variable with the result.You must ensure that the variable always contains the most up-to-date information from the Master table, and you want to lock the table exclusively while the query runs.Which action should you take?In this scenario, you wanted to lock the Master table exclusively for a given query. To do so, you can use the TABLOCKX query hint.You should not set the ALLOW_SNAPSHOT_ISOLATION database option to ON. The ALLOW_SNAPSHOT_ISOLATION database option controls whether transactions with a SNAPSHOT isolation level are allowed. A value of ON indicates transactions with a SNAPSHOT isolation level are allowed.You should not include the READPAST query hint in the query containing the aggregate calculations because this would not ensure the query always received the most up-to-date data. The READPAST query hint ignores any current locks and reads past those rows. Any locked rows would not be included in your aggregations.You should not perform the aggregate calculations within a transaction, and set the transaction’s isolation level to REPEATABLE READ. In this scenario, you only wanted to lock the table during the duration of a query. Therefore, using a table hint would be sufficient.
Question:
Which action should you take?
Options:
Set the ALLOW_SNAPSHOT_ISOLATION database option to ON.
Perform the aggregate calculations within a transaction, and set the transaction’s isolation level to REPEATABLE READ.
Include the READPAST query hint in the query containing the aggregate calculations.
Add the TABLOCKX hint to the query containing the aggregate calculations.
Correct Answer
The Correct Answer for this Question is
Add the TABLOCKX hint to the query containing the aggregate calculations.
Explanation
The Question – Which action should you take? has been answered correctly and answers for the question is Add the TABLOCKX hint to the query containing the aggregate calculations.
More about these Exams
These Exam Questions and the order of these questions keep changing. but the answers are obviously same. so if you don’t find a question after another we suggest you search it in the search box and we are sure you’ll find it. you can bookmark this site for Quick access in future.
We hope you found it helpful don’t forget to leave a comment if you feel a need to correct or ask we’re always here to help.
you can find more here at mnccertified
Feel free to contact via comment or email.
Happy Learning
Cheers, Team MNCcertified