You can grant privileges to an individual user or to a list of users. You can also specify the PUBLIC keyword to grant privileges to all users.
User List: |--+-PUBLIC---------+-------------------------------------------| | .-,----------. | | V | | '---+-user---+-+-' '-'user'-'
Element | Description | Restrictions | Syntax |
---|---|---|---|
user | Login name of a user to whom you are granting privilege or granting a role | Must be a valid authorization identifier | Owner Name,
p. Owner Name |
The following example grants the Insert table-level privilege on table1 to the user mary in a database that is not ANSI-compliant:
GRANT INSERT ON table1 TO mary;
In an ANSI-compliant database, if you do not include quotes as delimiters around user, the name of the user is stored in uppercase letters.
You can use the GRANT statement to associate a list of one or more users (or all users, using the PUBLIC keyword) with a role name that can describe what they do. After you declare and grant a role, access privileges that you grant to that role are thereby granted to all users who are currently associated with that role.
Role Name: |--+-role---+---------------------------------------------------| '-'role'-'
Element | Description | Restrictions | Syntax |
---|---|---|---|
role | Role that is granted, or to which a privilege or another role is granted | Must exist. If enclosed between quotation marks, role is case sensitive. | Owner Name, p. Owner Name |
You can also grant an existing role to another role. This action gives whatever privileges the granted role possesses to all users who have the receiving role.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]