SET LANGUAGE#

Specifies the language environment for the session. The session language determines the datetime formats and system messages.

Every language listed in sys.syslanguages is accepted.

Syntax#

SET LANGUAGE { [ N ] 'language' | @language_var }  [;]

Arguments#

[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 sysname.

Remarks#

The language is found by its name or its alias, in any letter case; trailing spaces are ignored. A name that is not in sys.syslanguages fails with error 2740.

Setting a language changes @@LANGUAGE and sets the session date format (see SET DATEFORMAT) and the first day of the week (@@DATEFIRST) to the defaults of that language. A setting made earlier in the same batch with SET DATEFORMAT or SET DATEFIRST is kept: the language changes only the setting the batch did not set explicitly. A setting made in an earlier batch is replaced, and a reset of a pooled connection returns both to the defaults of the login language.

A character string converted to a date is read with the month names of the session language. The following parts of the language are not applied yet: month and day names returned by DATENAME stay in English, and system messages do not follow the session language.

Permissions#

Requires membership in the public role.

Examples#

The following example sets the German language by its alias and shows the date format and first day of the week it brings.

SET LANGUAGE German;
SELECT @@LANGUAGE AS language_name, @@DATEFIRST AS date_first;

See Also#