RAISERROR ('Invalid Input', 0, 9)
RAISERROR ('Invalid Input', 10, 9)
相当于ShowMessage()
----------
Invalid Input
RAISERROR ('Invalid Input', 1, 9)
...
RAISERROR ('Invalid Input', 9, 9)
会先显示Message后显示message级别等信息.
---------------
Invalid Input
Msg 50000, Level 9, State 9
RAISERROR ('Invalid Input', 11, 9)
RAISERROR ('Invalid Input', 18, 9)
会先显示Message级别等信息后显示message.
---------------
Msg 50000, Level 18, State 9, Line 1
Invalid Input
RAISERROR ('Invalid Input', 19, 9)
会显示错误,此时必须使用with log.
RAISERROR ('Invalid Input', 20, 9) with log
-----------------
Msg 2745, Level 16, State 2, Line 1
Process ID 52 has raised user error 50000, severity 20. SQL Server is terminating this process.
Msg 50000, Level 20, State 9, Line 1
Invalid Input
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
lts, if any, should be discarded
.
本文详细介绍了SQL Server中RAISERROR函数的不同用法及其如何影响错误信息的显示方式。通过具体的例子展示了不同参数设置下错误消息的展示顺序及内容,帮助读者理解如何更有效地使用RAISERROR来定制错误处理流程。
5071

被折叠的 条评论
为什么被折叠?



