How to throw exception from SQL server 2005 functi

2019-07-03 05:07发布

When I try to use RaiseError, I get the following compilation issue

Msg 443, Level 16, State 14, Procedure ConvertSessionToCurr, Line 19 Invalid use of a side-effecting operator 'RAISERROR' within a function.

So how do we handle exception in a function/ Change it to a out param stored proc? That really sounds like a bummer!

1条回答
劳资没心,怎么记你
2楼-- · 2019-07-03 05:44

Options:

  • Return NULL or some sentinel value
  • Use a stored procedure
  • Make it inline code

My thought is that if you need RAISERROR in a UDF you're using it wrong...

查看更多
登录 后发表回答