Delen via


sp_defaultlanguage (Transact-SQL)

Changes the default language of for a SQL Server login.

Important

This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER LOGIN instead.

Topic link iconTransact-SQL Syntax Conventions

Syntax

sp_defaultlanguage [ @loginame = ] 'login' 
     [ , [ @language = ] 'language' ] 

Arguments

  • [ @loginame = ] 'login'
    Is the login name. login is sysname, with no default. login can be an existing SQL Server login or a Windows user or group.

  • [ @language = ] 'language'
    Is the default language of the login. language is sysname, with a default of NULL. language must be a valid language on the server. If language is not specified, language is set to the server default language; default language is defined by the sp_configure configuration variable default language. Changing the server default language does not change the default language for existing logins.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_defaultlanguage calls ALTER LOGIN, which supports additional options. For information about changing other login defaults, see ALTER LOGIN (Transact-SQL).

Use the SET LANGUAGE statement to change the language of the current session. Use the @@LANGUAGE function to show the current language setting.

If the default language of a login is dropped from the server, the login acquires the default language of the server. sp_defaultlanguage cannot be executed within a user-defined transaction.

Information about languages installed on the server is visible in the sys.syslanguages catalog view.

Permissions

Requires ALTER ANY LOGIN permission.

Examples

The following example uses ALTER LOGIN to change the default language for login Fathima to Arabic. This is the preferred method.

ALTER LOGIN Fathima WITH DEFAULT_LANGUAGE = Arabic;
GO