SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Raise languange specific errors
 New Topic  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

3867 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  
 New 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.05 seconds. Powered By: Snitz Forums 2000