ALTER LOGIN (TSQL Statement)

changes attributes of the specified login.

Syntax

ALTER LOGIN login_name [ ENABLE | DISABLE ]

ALTER LOGIN login_name WITH <option> [ ,... n ]

<option> ::=
      PASSWORD         = 'password'
    | DEFAULT_DATABASE = database
    | DEFAULT_LANGUAGE = language
    | NAME             = new_login_name

Arguments

login_name
is the login name.
ENABLE
enables the login.
DISABLE
disables the login.
PASSWORD = ‘password’
is the password used to authenticate the login when it connects to RSQL Server. It is a string.
DEFAULT_DATABASE = database
is the name of the default database to use just after connection is established.
DEFAULT_LANGUAGE = language
is the default language to use just after connection is established.
  • language is e.g. en_US, en_us, fr_CH, etc. French, english, german, etc are aliases for fr_FR, en_US, de_DE, etc.
NAME = new_login_name
is the new name of the login.

Remarks

Only sa is allowed to execute this statement.

Examples

ALTER LOGIN vladimir DISABLE;       -- disable the login

ALTER LOGIN julius WITH PASSWORD='V3ryStr0ngPassw0rd'; -- change password

ALTER LOGIN julius WITH NAME=gaius; -- change login name