Change Current Month Language in SQL Server 2014

Introduction

In this article I explain how to change the current month language to other languages depending on his/her country.

SET LANGUAGE

This changes the language from the default language to another country's language and it specifies the language environment for the session.

Syntax
 
SET LANGUAGE {[N] 'language' | @languageVar}

Here, "[N]'language' | @language_var" is the name of the language as stored in sys.syslanguages. This argument can be either Unicode or DBCS converted to Unicode. To specify a language in Unicode, use "N'language'". If specified as a variable, the variable must be a sysname.

The Database Engine contains the following languages.

You can execute the simple query given below to see the Database Engine languages:

select alias from syslanguages;

 Output

 database-engine-languages.jpg

Example

An example to change the language for a current month in SQL:

DECLARE @Today DATETIME

SET @Today = GETDATE()

SET LANGUAGE us_english

SELECT DATENAME(month, @Today) AS 'Month Name in default language'

SET LANGUAGE Italian

SELECT DATENAME(month, @Today) AS 'Month Name in italian'

SET LANGUAGE Greek

SELECT DATENAME(month, @Today) AS 'Month Name in english'

SET LANGUAGE French

SELECT DATENAME(month, @Today) AS 'Month Name in  french'

SET LANGUAGE Arabic

SELECT DATENAME(month, @Today) AS 'Month Name in arabic'

SET LANGUAGE German

SELECT DATENAME(month, @Today) AS 'Month Name in German'

 

 

 Output

change-current-month-language.jpg

Up Next
    Ebook Download
    View all
    Learn
    View all