Hi friends, today in SQL Server system stored procedure series you will learn about how to drop user-defined message from sys.messages table using stored procedure sp_dropmessage.
Sp_dropmessage stored procedure is used to drop user-defined error message. It requires membership in sysadmin and serveradmin server roles.
Syntax of sp_dropmessage is as follows:
Sp_dropmessage [@msgnum =] msgid,
[@lang =] ‘language’
Arguments
@msgnum is the Id of the message having datatype Int. Msg_id must be unique along with the combination of language.
@lang is the language of the message which specifies in which language message is written.
In previous blog we have added a user-defined message here.
Now, we will drop that previously added message using sp_dropmessage:
EXEC sp_dropmessage50001,'us_english'
When we will check in table sys.messages that entry was removed.
That’s all folks for the day. Hope you like the post.
Regards,
Kapil Singh
Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook