Answers for "T-SQL Retry (deadlock)"

SQL
0

T-SQL Retry (deadlock)

Declare @Counterloop int =0, @IsSuccess int = 0
 
while (@Counterloop <=3 and @IsSuccess = 0)
Begin
    Begin Try
 
        --Piece of code for Retry/Re-Execution - START--
        select 1/0
        ---EXEC Rexcute_Retry_SP
        --Piece of code for Retry/Re-Execution - END--
 
        set @IsSuccess=1
 
    END TRY
    BEGIN Catch
        IF (@Counterloop<=2) Begin
            set @Counterloop=@Counterloop+1
            print 'counter value is'+ cast(@Counterloop as varchar)
        END
        ELSE Throw;
    END Catch
END
Posted by: Guest on January-31-2022

Code answers related to "SQL"

Browse Popular Code Answers by Language