Change Error Message

nito8300
nito8300 used Ask the Experts™
on
Hi All,
I would like to customize some error messages on my SQL box so that when i'm doing maintenance and i disable access the users don't panic.

one error is: (when I restrict the db)
Connection failed:
SQLState: '08004'
SQL Server Error: 4060
Server rejected the connection; Access to selected database has been denied

I used the following code:

use master
exec sp_configure 'allow updates',1
RECONFIGURE WITH OVERRIDE
update dbo.sysmessages
set description = 'Server is currently unavailable...don't panic!'
where error = 4060
exec sp_configure 'allow updates',0
RECONFIGURE

But I still get the same message.
Any ideas? My next guess is it can't be done.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
The SQL Server error messages are stored in the sysmessages system table.
However be aware that sysmessages is stored in the master database, and
affects ALL the databases, so if you have multiple applications using
multiple databases on one server, changing sysmessages will affect ALL the
applications.


Also be aware that sysmessages contains place holders for variable
information ... things like database names, table names, etc. Unless you can
structure your customized error messages to use the place holders in the
same sequence as they appear in sysmessages, you might be out of luck.

So I think, its a good idea not to mess up with system tables.
Probably much better to handle custom errors like this:

http://www.sqlteam.com/item.asp?ItemID=2841

Author

Commented:
MNelson,
Thanks for the post. Most of the user access the SQL Server thru ODBC - that's what I'm trying to customized.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial