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

SET PASSWORD

Chapter contents

The SET PASSWORD statement allows the Master user to change the password for a secured database and a normal user to change his or her login password for a database.

Syntax

SET "PASSWORD" = password 
password ::= user-defined-name 

Remarks

SET PASSWORD may be issued at any time by either the Master user or a normal user. (SET SECURITY, in contrast, can be issued only by the Master user and the Master user's session must be the only current database connection.)

If issued by the Master user, SET PASSWORD changes the password for the entire database (all DDF files). If issued by a normal user, SET PASSWORD changes the login password for that user only in the user.ddf file.

The Master user or a normal user must be logged in to the database before SET PASSWORD can be issued. Note that "password" is not a reserved keyword. It may be used as a name for a table or column. However, when used in the SET PASSWORD statement, it must be enclosed by double quotes.

The minimum length allowed for a password is eight bytes. You may use any displayable character in a password except for the question mark (?), the double quote ("), and the single quote (').

The space character may be used in a password provided it is not the first character. If a password contains a space character, the password must be enclosed by single quotes. As a rule of thumb, avoid using the space character in a password.

A user-defined password is case sensitive. If the password begins with a non-alphabetic character, the password must be enclosed in single quotes.

Examples

The following example shows the Master user enabling security on the database with a password of "bigdog." The Master user then grants login authority to user "user45" with a password of "popcorn," and grants user45 SELECT permissions to table person. The Master user then changes the security password for Master to "tinycat."

SET SECURITY = bigdog 
	--this changes the password for all DDFs 
GRANT LOGIN TO user45:popcorn 
GRANT SELECT ON person TO user45 
SET "PASSWORD" = tinycat 
	--this changes the password for all DDFs 

The following example assumes that user45 has logged in to the database with a password of "popcorn." User45 changes her password to "tomato." User45 then selects all records in the person table.

SET "PASSWORD" = tomato 
	--this changes only user45's password in user.ddf 
SELECT * FROM person 
	--user45 still has SELECT rights on table person 

See Also

SET SECURITY


Chapter contents
Book contents

Prev topic: SET OWNER
Next topic: SET PROCEDURES_CACHE