出现如下死锁怎么解决,必给分!
You have a database named SALES. It has a table named INVENTORY.
New sales information to the database updates the inventory table. When the
process execute it gives an error message "Transaction was deadlocked on
resources with another process etc. "
The stored procedure looks like the following.
CREATE PROCEDURE
Update Inventory @ Int ID int
As
Begin
DECLARE @ COUNT int
BEGIN TRANS
SELECT @ Count = Available
From Inventory with (Hold Lock)
WHERE Inventory ID = @ Int ID
IF ( @ Count >0)
UPDATE Inventory SET Available = Count - 1
Where Inventory ID = @ Int ID
COMMIT TRANS
END
A. Change Table hint to UPDATE
B. Remove table hint
C. Change Table hint to Repeatable Read
D. Set Transaction isolation level Serializable
E. Set Transaction isolation level Repeatable Read