What is the syntax meaning of RAISERROR()

前端 未结 5 2031
情歌与酒
情歌与酒 2021-02-02 05:39

I just created a Instead After Trigger whose syntax is given below:

Create trigger tgrInsteadTrigger on copytableto
Instead of Insert as 
    Declare @store_name         


        
5条回答
  •  清酒与你
    2021-02-02 06:02

    The severity level 16 in your example code is typically used for user-defined (user-detected) errors. The SQL Server DBMS itself emits severity levels (and error messages) for problems it detects, both more severe (higher numbers) and less so (lower numbers).

    The state should be an integer between 0 and 255 (negative values will give an error), but the choice is basically the programmer's. It is useful to put different state values if the same error message for user-defined error will be raised in different locations, e.g. if the debugging/troubleshooting of problems will be assisted by having an extra indication of where the error occurred.

提交回复
热议问题