ALTER LOGIN

Change properties of a SQL Server login account.

Syntax
      ALTER LOGIN login ENABLE

      ALTER LOGIN login DISABLE

      ALTER LOGIN login WITH option [ ,... ] 

  options:            
    PASSWORD = 'password' 
    [ 
      OLD_PASSWORD = 'oldpassword' 
      | password_option [password_option] 
    ]
    DEFAULT_DATABASE = database
    DEFAULT_LANGUAGE = language
    NAME = login
    CHECK_POLICY = {ON | OFF}
    CHECK_EXPIRATION = {ON | OFF}
    CREDENTIAL = credential
    NO CREDENTIAL
  
  password_option:
    MUST_CHANGE | UNLOCK

Key:
  login            SQL Server login.
  password         A SQL Server login password for the login.
  oldpassword      Current SQL Server login password for the login.
  HASHED           The SQL Server login is already hashed. (so don't hash again)
  credential       Credential to be mapped to the new SQL Server login.
  NO CREDENTIAL    Removes an existing mapping of the login to a server credential.
  DEFAULT_DATABASE The default database to be assigned to the login.(default = master)
  DEFAULT_LANGUAGE The default language to be assigned to the login.
  NAME=login       Rename the login
  CHECK_EXPIRATION Enforce password expiration policy
  CHECK_POLICY     Enforce Windows password policy
  MUST_CHANGE      Prompt the user for a new SQL Server password
  UNLOCK           Unlock a SQL Server login that is locked out.

Passwords are case-sensitive.

Manually reset the bad password count by briefly setting CHECK_POLICY = OFF, followed by CHECK_POLICY = ON.

Prehashing of passwords is supported only when you are creating SQL Server logins.

If MUST_CHANGE is specified, CHECK_EXPIRATION and CHECK_POLICY must be set to ON.

Example

ALTER LOGIN Simon64 ENABLE;

ALTER LOGIN Simon64 WITH PASSWORD = '1stupidlylongpassword';

"I change myself, I change the world" ~ Gloria Anzaldua

Related:

CREATE LOGIN
DROP LOGIN

CREATE CREDENTIAL
EVENTDATA( )
Password generator
Equivalent Oracle command: ALTER USER


© Copyright SS64.com 1999-2014
Some rights reserved