Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)

后端 未结 8 657
粉色の甜心
粉色の甜心 2020-12-16 10:37

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,

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-16 11:07

    Check trigger nesting level right at the beginning of the trigger by using TRIGGER_NESTLEVEL function and stop the trigger to perform action if the trigger level is greater than 1.

     IF TRIGGER_NESTLEVEL() > 1
         RETURN
    

    The error is occurring due to the nesting level exceeding its limit, because we all know that trigger continuously fires and its difficult to control that behavior of the trigger. The function TRIGGER_NESTLEVEL returns the nesting level and we can stop the nesting level to increase.

提交回复
热议问题