I want to send an email if my stored procedure fails on any one of the 6 table inserts. The email is not working.
After each insert, I include a check for errors. If errors are found, the program breaks out of the cursor loop and does a GOTO to a Fail block.
This is the code snippet:
BEGIN --begin Fail
--#1 - send email to itsystems
IF ( @err <> 0 ) -- Error found in one of the inserts
--SET @recipients1 = 'firstname.lastname@example.org;
SET @recipients1 = AnotherMail@email.com;
SET @subject1 = 'COOP DATABASE STORED PROCEDURE FAILURE -- Project Number' -- "' + RTRIM(LTRIM(@ProjectName)) + '"' ;
SET @body1 = 'COOP stored procedure uspCorporateAdSubmitClaims failed.'
--SET @body1 = 'COOP stored procedure uspCorporateAdSubmitClaims failed for project number '
+ LTRIM(RTRIM(@ProjectNumber)) + '.'
+ CHAR(13) + CHAR(10) + 'No claims were created for project numb
View Complete Post