I am creating a store procedure but while executing the procedure i am getting the particular error.
Msg 217, Level 16, State 1, Procedure SendMail_Renewapp,
My problem is with a stored procedure, not a trigger, and no cursor. An EXEC
command within the procedure is the reason as other answers pointed out. But I can't add GO
anywhere before the EXEC
command with SSMS v18.5. It gives me an error. Turns out the procedure nested inside has its own TRY/CATCH block. Adding GO
at the end of that procedure doesn't solve the problem. I had to remove the TRY/CATCH block there to make it works. Not sure this is just me or it can be helpful to others.