Pages

Social Icons

Thursday 6 February 2014

Add error messages in SQL-Server

Hi All,

Below is the example how we can add our own error messages in SQL-Server.

Que: I want to add my own error message in sql server what can I do for this.

Ans: We can defined our own error using sp_addmessage. Below is the syntax.

exec sp_addmessage 50001,16, 'Hello Rahul Singi'

Now when we will raise the error 50001 we will get the message “Hello Rahul Singi”

--- output ---
Msg 50001, Level 16, State 1, Line 2

Hello Rahul Singi

Thanks,
RS

No comments:

Post a Comment