October 3, 2013 | Posted in: SQL Server

This is a classic issue whilst using SQL Server, where two processes are trying to lock the same resources at the same time. If you are handling this with some sort of retry mechanism like myself, try the following to slow SQL Server down before attempting the command again.

/* delay retry for a random number of seconds >= 4 and <= 9 */
declare @Random int, @Upper int, @Lower int, @time varchar(50);

set        @Lower = 4
set        @Upper = 9
select    @Random = ROUND(((@Upper – @Lower -1) * RAND() + @Lower), 0)

set @time = ’00:00:0′ + cast(@Random as varchar(50))


Be the first to comment.

Leave a Reply


3 + twenty =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>