CREATE USER Statement

Creates a user.

Syntax

CREATE USER  user-name  [ IDENTIFIED BY password ]
[ LOGIN POLICY policy-name ]
[ FORCE PASSWORD CHANGE { ON | OFF } ]

Examples

Usage

user-name—Name of the user.

IDENTIFIED BY clause—Provides the password for the user.

policy-name—Name of the login policy to assign the user. No change is made if LOGIN POLICY is not specified.

FORCE PASSWORD CHANGE clause—Controls whether the user must specify a new password when they log in. This setting overrides the PASSWORD_EXPIRY_ON_NEXT_LOGIN option setting in their policy.

You do not have to specify a password for the user. A user without a password cannot connect to the database. This is useful if you are creating a group and do not want anyone to connect to the database using the group user ID. A user ID must be a valid identifier.

User IDs and passwords cannot:
  • Begin with white space, single quotes, or double quotes

  • End with white space

  • Contain semicolons

A password can be either a valid identifier, or a string (maximum 255 bytes) placed in single quotes. Passwords are case-sensitive. Sybase recommends that the password be composed of 7-bit ASCII characters, as other characters may not work correctly if the database server cannot convert them from the client's character set to UTF-8.

The VERIFY_PASSWORD_FUNCTION option can be used to specify a function to implement password rules (for example, passwords must include at least one digit). If a password verification function is used, you cannot specify more than one user ID and password in the GRANT CONNECT statement. For details, see VERIFY_PASSWORD_FUNCTION Option and GRANT Statement.

Standards

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.

Permissions

Requires DBA or USER ADMIN authority.

Related reference
COMMENT Statement
CREATE LOGIN POLICY Statement
DROP LOGIN POLICY Statement
DROP USER Statement
GRANT Statement
PASSWORD_EXPIRY_ON_NEXT_LOGIN Option
VERIFY_PASSWORD_FUNCTION Option
ALTER LOGIN POLICY Statement