Which query hint should you recommend?

You are a database developer. You plan to create a database by using SQL Server 2008. A database contains a table named Sales. The Sales table contains customer order summary information. You create a stored procedure that uses a SELECT statement. At the moment of execution, the procedure must return a precise summation of the total sales for the current day. You need to use a query hint to prevent any data modification in the Sales table when the stored procedure is being executed. Which query hint should you recommend?

You are a database developer. You plan to create a database by using SQL Server 2008. A database contains a table named Sales. The Sales table contains customer order summary information. You create a stored procedure that uses a SELECT statement. At the moment of execution, the procedure must return a precise summation of the total sales for the current day. You need to use a query hint to prevent any data modification in the Sales table when the stored procedure is being executed. Which query hint should you recommend?

A.
READPAST

B.
HOLDLOCK

C.
TABLOCKX

D.
READCOMMITTED

Explanation:
TABLOCKX takes an exclusive lock on the table that is held until the end of the command or transaction.



Leave a Reply 0

Your email address will not be published. Required fields are marked *