I'm trying to update a row in a table upon someone viewing the page (it increments the viewed count), however now and then I get a deadlock error, I'm guessing this is due to two or more people trying to update the same row?
The error is:
Transaction (Process ID 60) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
And my SQL is:
UPDATE [ProductDescription]
SET [ViewCount] = ([ViewCount] + 1)
WHERE ProductCode = @prodCode
AND ApplicationID = @AppID
I believe I may need a WITH(NOLOCK)?