ALTER DATABASE ROLE¶
Modifies the properties for an existing database role.
Currently, the only supported operations are renaming a database role or adding/overwriting/removing a comment for a database role.
- See also:
CREATE DATABASE ROLE , DROP DATABASE ROLE , SHOW DATABASE ROLES
ALTER DATABASE ROLE [ IF EXISTS ] <name> RENAME TO <new_name> ALTER DATABASE ROLE [ IF EXISTS ] <name> SET COMMENT = '<string_literal>' ALTER DATABASE ROLE [ IF EXISTS ] <name> UNSET COMMENT
Specifies the identifier (i.e. name) for the database role; must be unique in the database in which the role is created.
The identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (e.g.
"My object"). Identifiers enclosed in double quotes are also case-sensitive.
If the identifier is not fully qualified in the form of
db_name.database_role_name, the command looks for the database role in the current database for the session.
RENAME TO new_name
Specifies the new identifier for the database role; must be unique for your account.
For more details, see Identifier Requirements.
Note that when specifying the fully-qualified name of the database role, you cannot specify a different database. The name of the database,
db_name, must remain the same. Only the
database_role_namecan change during a rename operation.
Specifies the properties to set for the database role:
COMMENT = 'string_literal'
Adds a comment or overwrites an existing comment for the database role.
Specifies the properties to unset for the database role, which resets them to the defaults.
Only the database role owner (i.e. the database role with the OWNERSHIP privilege on the database role), or a higher role, can execute this command.
Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata Fields in Snowflake.
Rename database role
dbr2 in database
ALTER DATABASE ROLE d1.dr1 RENAME TO d1.dbr2;
Add a comment for database role
ALTER DATABASE ROLE d1.dbr2 SET COMMENT = 'New comment for database role';