PreviousSQL Engine Reference (v9 SP2 (9.5) revision 1) Next

CREATE USER

Chapter contents

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 USER user-name [ WITH PASSWORD user-password ][ IN GROUP 
referencing-alias ] 

Remarks

This function is an extension to SQL grammar as documented in the Microsoft ODBC Programmer's Reference.


Note
This statement creates a user with the same rights as those of a user created using the Pervasive Control Center (PCC). 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 Pervasive PSQL databases and are not related to user names and passwords set at the operating system level. Pervasive PSQL user names, groups, and passwords can also be configured through the Pervasive PSQL Control Center (PCC).

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 non-alphanumeric characters.

If you create a user as the member of a group, you must set up the group before creating the user.

For further general information about users and groups, see Master User and Users and Groups in Advanced Operations Guide.

Examples

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's 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 non-alphanumeric characters. The user's 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's password is Prsve1 (case-sensitive).

CREATE USER pgranger WITH PASSWORD "Nonalfa$" 

The new user name is pgranger. The user's password is Nonalfa$ (case-sensitive) with non-alphanumeric 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.

See Also

ALTER USER

DROP USER

GRANT


Chapter contents
Book contents

Prev topic: CREATE TRIGGER
Next topic: CREATE VIEW