30.06.2013 Views

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

203<br />

Chapter 7: Maintaining a Code Library<br />

/**********************<br />

Name: Enterprise Deadlock Catch block<br />

Create Date: 1/1/2010<br />

Version: 2005 or greater<br />

Notes: Retries a set of code a set number of times in the event of a deadlock,<br />

takes into account that an error can be reentrant without resubmitting the code.<br />

***********************/<br />

DECLARE @Retry AS INT,<br />

@RetryCount AS INT,<br />

@MaxRetries AS INT<br />

SET @Retry = 1 ;<br />

SET @RetryCount = 0 ;<br />

SET @MaxRetries = 3 ;<br />

WHILE @Retry = 1<br />

AND @RetryCount

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!