"Ad hoc updates to system catalogs are not enabled" in SQL Server

I got this error while trying to add records to sysmessages table in master db.

 Ad hoc updates to system catalogs are not enabled. The system administrator must reconfigure SQL Server to allow this. 
 The fix is, login with Admin privileges and performt these
 SP_CONFIGURE 'ALLOW UPDATES', 1
GO
RECONFIGURE WITH OVERRIDE
GO
insert into master.dbo.sysmessages
values (.............)
GO
SP_CONFIGURE 'ALLOW UPDATES', 0
GO
RECONFIGURE WITH OVERRIDE
GO
  A much bettter solution to this is (thanks to Raghu for pointing out) 
 /* Sys Messages catalog */sp_addmessage @msgnum =  <number>,@severity = <sev_id>,@msgtext = '<err_text>',@replace='replace'
  

Comments