SQL Server 2008R2.
I have a stored procedure which uses an IF/ELSE statement. This runs inside a SQL Agent job
In the IF section, I check for the value of a parameter.
If the value is NULL, I want to exit the stored procedure, and relay to SQL Agent this step failed.
I'm currently using the following. This will exit, but SQL Agent reports success:
IF @LASTDAY is NULL BEGIN Print ''No records were loaded into TABLE X - Sending Email'' RETURN END
Any thoughts on how to tell SQL Agent the step failed?
-Al H