开发者

SQL Server 2005 Message Localisation

I have a bunch of stored p开发者_JAVA技巧rocedures which use RAISERROR to return to the client C# application certain business-logic error messages, and now I wonder if there is a way to localize these message in a way similar to .NET. Can these messages be localized somehow, or do they have to be hard-coded in the "main" language being used?

Side question: I have a .NET class library containing a resource file with strings. Can I use this dll from SQL Server 2005 and retrieve these error messages from that resource file?


SQL Server has localisation for the built-in system messages for many languages/locales.

For your own custom messages, you will have to catch and translate them in your application layer.

It 'might' be possible to use your .NET dll from SQL Server 2005 and retrieve these error messages from that resource file using a CLR Stored Procedure, but I wouldn't recommended doing it that way (it has permissions/deployment implications that are frankly best avoided).


Mitch indicated that the built in messages are localized. He didn't mention that you can use the same localization system for your own message. sp_addmessage lets you add new messages (and specify the language).

You then use the version of RAISERROR that uses a message number, rather than a message text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜