Joe Webb Blog

Musing and observations about SQL Server, other technogies, and sometimes just life in general

The 33 languages of SQL Server

I was recently perusing the the MSDN SQL Server forums and noticed a question about localization of Microsoft SQL Server messages. I replied to the post with a mention of the sys.messages table - the table where SQL Server messages are stored. I blogged about this system table a few months ago.

Afterward I started playing around some more with the sys.messages table. I started with the following basic query.

 languages1-2008-05-30

The first thing to notice is that each message_id has one or more languages associated with it. Message_id 21, for example, has a row for language_id 1033, 1031, 1036, etc. It's fairly obvious to me that language_id 1033 is my native tongue, English. And I can make some educated guesses on some of the other languages. But where are they defined?

Well, the syslanguages system table contains a list of each language that SQL Server recognizes. For example, run the following query in a Management Studio Query Window.

languages2-2008-05-30

1033 is indeed US English. And 1031 is German, 1036 is French, and so on. There are 33 languages in all - US English and British English are considered two different languages in here, though they share the same messages.

But what's interesting is that not all languages in the syslanguages system table are represented in the sys.messages table. For example, consider the following query.

SELECT 
m.language_id
,l.alias
,COUNT(*)
FROM
sys.messages AS m JOIN
 syslanguages AS l
ON l.msglangid = m.language_id
GROUP BY
l.alias
,m.language_id

 

The results indicate that only 11 languages (10 if you consider US English and British English to be one and the same) are represented in the sys.messages table. 

languages3-2008-05-30

So, that must mean that the other languages don't have a need for messages. :) Right, if that's that case, remove US English from the list!

Actually if a language is not present in the sys.messages table, a default language will be used instead. For more information, check out the sp_addmessage procedure and the sys.messasges system table in Books Online.

Cheers!

Joe

kick it on DotNetKicks.com

Legacy Comments


Bennie Ribaldi
2008-07-12
re: The 33 languages of SQL Server
Joe: what tool do you use to get those screen grabs with the jagged edges?

Joe Webb
2008-07-12
re: The 33 languages of SQL Server
I use SnagIt for the screenshots. It's a great product.

Arthur Kirchner
2010-07-14
re: The 33 languages of SQL Server
Cheers,

nice one. The query needed a sys. in front of syslanguages to work for me:

SELECT
m.language_id
,l.alias
,COUNT(*)
FROM
sys.messages AS m JOIN
SYS.syslanguages AS l
ON l.msglangid = m.language_id
GROUP BY
l.alias
,m.language_id