Вопрос с экзамена 70-229
От: LandWarrior  
Дата: 13.08.02 14:45
Оценка:
Сегодня сдавал 70-229. Там был такой вопрос

You are a database developer for a clothing retailer. The company has a database named Sales. This database contains a table named Inventory. The Inventory table contains the list of items for sale and the quantity available for each of those items. When sales information is inserted into the database, this table is updated. The stored procedure that updates the inventory table is shown below:

CREATE PROCEDURE UpdateInventory @IntID int
AS
BEGIN

DECLARE @Count int

BEGIN TRAN

SELECT @Count = Available
FROM Inventory WITH (HOLDLOCK)
WHERE InventoryID = @IntID

IF (@Count > 0)
UPDATE Inventory SET Available = @Count – 1
WHERE InventoryID = @IntID

COMMIT TRAN

END

When this procedure executes, the database server occasionally returns the following error message:

Transaction (Process ID 53) was deadlock on {lock} resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

You need to prevent the error message from occurring while maintaining data integrity. What should you do?

A. Remove the table hint.
B. Change the table hint to UPDLOCK.
C. Change the table hint to REPEATABLEREAD.
D. Set the transaction isolation level to SERIALIZABLE.
E. Set the transaction isolation level to REPEATABLE READ.


Я выбрал B. Тем не менее, мне интересно кто какой ответ считает правильным и почему?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.