First of all, there should be an index that supports the WHERE clause in your UPDATE statement.
Next, the conditions in the WHERE clause should not entangle the indexed column in any expressions, as that is likely to render the index less useful.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Team,
I am working on a SQL Server Stored Procedure, where I need to update a column of a table in a no. of rows.
This stored procedure will be called from a timer trigger Azure function, which will scale so that 2 function instances may call the stored procedure at same time and work on same same rows. Please let me know how should I write the update statement so that I do not face any table locking issue in the future.
Please let me know if any other detail is needed.
Thanks,
Salil
First of all, there should be an index that supports the WHERE clause in your UPDATE statement.
Next, the conditions in the WHERE clause should not entangle the indexed column in any expressions, as that is likely to render the index less useful.
It’s depends on the update logic whether or how often a deadlock can occur. But your code should recover from a deadlock as it is an expected response.