Home > Sql Server > Set Language in Sql Server

Set Language in Sql Server


When  you are working with multi lingual web applications, you may need to retrieve data like month name, day name etc to be displayed in different languages. For example month “June” is in English, its dutch translation would be “Juni” .This is possible with “Set Language languagname” feature of sql server. where language name is the name of language you want to set.. you can complete list of languages that sql support using

select * from sys.syslanguages

Below is one example using set language, retrieving day and month name in different languages:
DECLARE @Today DATETIME
SET @Today = ‘6/22/2009’

SET LANGUAGE Deutsch
SELECT DATENAME(month, @Today) AS ‘Month Name in Dutch’
SELECT DATENAME(dw, @Today) AS ‘Day Name in Dutch’

SET LANGUAGE us_english
SELECT DATENAME(month, @Today) AS ‘Month Name in English’
SELECT DATENAME(dw, @Today) AS ‘Day Name in English’

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: