The CREATE USER statement creates a new user account in a database.
This function can be used to create a user account in a database with a password, without a password, or as member of a group.
Syntax
CREATE USERuser-name [ WITH PASSWORDuser-password ][ IN GROUPreferencing-alias ]
Remarks
Note This statement creates a user with the same rights as those of a user created using the Zen Control Center (ZenCC). For example, the created user is not restricted by default from creating a database even if the user is not logged in as Master.
Only the Master user can execute this statement.
Security must be turned on to perform this statement.
User-name and user-password here only refer to Zen databases and are not related to user names and passwords set at the operating system level. Zen user names, groups, and passwords can also be configured through the Zen Control Center (ZenCC).
User name must be unique in the dictionary.
The user name and password must be enclosed in double quotes if they contain spaces or other nonalphanumeric characters.
If you create a user as the member of a group, you must set up the group before creating the user.
The following examples show how to create a new user account without any login privileges and without a membership in any group.
CREATE USER pgranger
The new user name is pgranger. The user password is NULL and the user account is not a member of any group.
CREATE USER "polly granger"
The new user name is polly granger with nonalphanumeric characters. The user password is NULL and the user account is not a member of any group.
============
The following examples show how to create a new user account with login privileges that is not a member of any group.
CREATE USER pgranger WITH PASSWORD Prvsve1
The new user name is pgranger. The user password is Prsve1 (case-sensitive).
CREATE USER pgranger WITH PASSWORD "Nonalfa$"
The new user name is pgranger. The user password is Nonalfa$ (case-sensitive) with nonalphanumeric characters.
============
The following example shows how create a new user as a member of a group without login privileges.
CREATE USER pgranger IN GROUP developers
The new user name is pgranger. The new user account is a assigned to the group developers.
============
The following example shows how create a new user as a member of a group with login privileges.
CREATE USER pgranger WITH PASSWORD Prvsve1 IN GROUP developers
The new user name is pgranger. The new user account is assigned to the group developers and has the case-sensitive password Prvsve1. The order of this syntax (CREATE USER..WITH PASSWORD...IN GROUP) is absolutely necessary.