The “right” way to do stored procedure parameter validation

前端 未结 5 1992
灰色年华
灰色年华 2021-02-01 02:45

I have a stored procedure that does some parameter validation and should fail and stop execution if the parameter is not valid.

My first approach for error checking look

5条回答
  •  攒了一身酷
    2021-02-01 03:27

    I always use parameter @Is_Success bit as OUTPUT. So if I have an error then @Is_success=0. When parent procedure checks that @Is_Success=0 then it rolls back its transaction(with child transactions) and sends error message from @Error_Message to client.

提交回复
热议问题