Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

CREATE USER statement

Creates a database user or group.

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

    The name of the user you are creating.

  • IDENTIFIED BY clause

    The password of the user. A user without a password cannot connect to the database.

  • policy-name

    The name of the login policy to assign the user. If no login policy is specified, the DEFAULT login policy is applied.

  • 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 the user's policy.

Remarks

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.

If you use this statement in a procedure, do not specify the password as a string literal because the definition of the procedure is visible in the SYSPROCEDURE system view. For security purposes, specify the password using a variable that is declared outside of the procedure definition.

Privileges

You must have the MANAGE ANY USER system privilege.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

The following example creates a user named SQLTester with the password welcome. The SQLTester user will be required to specify a password when they log in.

CREATE USER SQLTester IDENTIFIED BY welcome
FORCE PASSWORD CHANGE ON;