T-SQL Repety (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
Important Impala