October 21, 2003 at 6:01 am
Hi!
I would like to change the text/contents of an existing system error message. Eg, system error message 2627 says "Violation of %ls constraint '%.*ls'. Cannot insert duplicate key in object '%.*ls'." I want to change the text to something more understandable to an end user and also translate it into Swedish.
All help appreciated!
/Peter
October 21, 2003 at 6:08 am
Hi,
first take a look at BOL for system tables->overview
quote:
System tables should not be altered directly by any user. For example, do not attempt to modify system tables with DELETE, UPDATE, or INSERT statements, or user-defined triggers.Reference of documented columns in system tables is permissible. However, many of the columns in system tables are not documented. Applications should not be written to query undocumented columns directly. Applications should instead use any of these components to retrieve information stored in the system tables
I guess you will be on your own when you do so.
However, these messages are stored in sysmessages in the master db.
What about trapping the error and having your own message table?
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
October 21, 2003 at 6:24 am
Thank you!
Well, I figured that updating system tables wouldn't be recommended. But I was thinking in the lines of creating my own error message and somehow redirecting the system error message to my message, when it occurs. Kind of overriding it. Any ideas?
/Peter
October 21, 2003 at 6:48 am
If an T-SQL statement produces an error, this error is catched in @@error.
You might want to take a look at BOL for @@error -> Using @@error to get some ideas on how to use it with a custom table.
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
October 21, 2003 at 6:48 am
The only way to stop the error is not to let it happen by checking for constraint violations before insert/update. This however could cause you to write a lot of code if you want to check for several errors. If you do check first, you could then use RAISERROR to produce an alternate message.
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply