Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

SQL Server - sp_addmessage can be used to create a User-Defined Error Message

Nov 23 2011 1:08PM by RKA   

Often in many stored procedures, we will throw same error message by using RaiseError(). Instead we can register that error message using sp_addmessage and use the error message in all the stored procedures.

For example, often we will throw same type of error message, "ObjectName already exists", and "objectname" will change often. Here, we can register an error message like below and can use this error in all the occurances. This will gives better maintainance.

The message id supplied must be greater than 50,000.


USE master
GO
EXEC sp_addmessage
50002,
10,
N'The data %s already exists!'
GO


RAISERROR (50002, 10, 1, 'mytext')

Read More..   [50 clicks]

Published under: SQL Server Tips ·  ·  ·  · 


RKA
91 · 2% · 598
12
 
5
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

Your Comment


Sign Up or Login to post a comment.

"SQL Server - sp_addmessage can be used to create a User-Defined Error Message " rated 5 out of 5 by 12 readers
SQL Server - sp_addmessage can be used to create a User-Defined Error Message , 5.0 out of 5 based on 12 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]