SQL Server/T-SQL/System/sp addmessage
Creating a User-Defined Error Message
10>
11> -- Creating the new message
12> EXEC sp_addmessage
13> 100001,
14> 14,
15> N"The current table %s is not updateable by your group!"
16> GO
1>
2> -- Using the new message (RAISERROR reviewed in the next recipe)
3> RAISERROR (100001, 14, 1, N"YourTableName")
4> GO
Modifying an already-defined error
7> EXEC sp_addmessage
8> @msgnum = 50005,
9> @severity = 16,
10> @msgtext = "Problem with ProductId numbers %i, %i, %i",
11> @Replace = "Replace"
12> GO
1>