Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Raise languange specific errors
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Aged Yak Warrior

596 Posts

Posted - 05/27/2013 :  13:18:03  Show Profile  Reply with Quote
We are looking into Raising Language-specific errors.

I noticed that SQL Server supports multiple languages for the same message id such as:

EXEC sp_addmessage 120063, 16, 'test message.', @lang = 'US_English';

EXEC sp_addmessage 120063, 16, 'test message Norwegian.', @lang = 'Norwegian';

But we want to raise error message 120063 for a language based on some criteria. I know that you can say:


But we want to do this based on some setting that can specify the language. I wish you could specify a language with RAISEERROR but looks like I can't. Any ideas how we can get around this?

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 05/27/2013 :  20:41:03  Show Profile  Reply with Quote
I don't know of a direct way to achieve what you are trying to do. The only thing I can think of is to query master.dbo.sysmessages with the messageid and the variable that representing the language to get the message string, and then present it. For example:
declare @msgstring varchar(255);
select @msgstring = [description] from sysmessages
where 120063 = 5001 and msglangid = 1044

If you have parameter tokens in the message, then you will need to do more work to do C-like substitution of positional parameters.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000