问题
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:
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...
来源:https://stackoverflow.com/questions/7789100/how-to-throw-exception-from-sql-server-2005-function