Categories:

User & Security DDL (Roles)

USE ROLE

Specifies the active/current primary role for the session. The currently-active primary role sets the context that determines whether the current user has the necessary privileges to execute CREATE <object> statements or perform any other SQL action.

Note that authorization to perform any SQL action other than creating objects can be provided by secondary roles.

For more information, see Access Control in Snowflake.

See also:

USE SECONDARY ROLES , CREATE ROLE , ALTER ROLE , DROP ROLE , SHOW ROLES

Syntax

USE ROLE <name>

Parameters

name

Specifies the identifier for the role to use for the session. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

Usage Notes

  • To use a role, the role must have been granted to the user.

  • Only a single primary role can be active at a time in a user session.

    Note that secondary roles enable you to perform SQL actions using the combined privileges of the other roles granted to you.

  • The USE command cannot be used to change the session context in a Snowsight worksheet. To select (or change) the current role for the user session, click the session context dropdown in the upper-right corner of Snowsight, and choose the desired role.

Back to top