- Categories:
Context Functions (Session)
ALL_USER_NAMES¶
Returns all user names in the specified account if an account name is passed, or all user names in the current account if no account name is passed.
Syntax¶
ALL_USER_NAMES( [ '<string_literal>' ] )
Arguments¶
Optional:
string_literal
The name of the account.
Note that the entire account name must be enclosed in single quotes. For example, if your Snowflake URL is
https://my-account.us-east-2.aws.snowflakecomputing.com
, use'my-account'
.
Returns¶
The data type of the returned value is ARRAY
.
Usage Notes¶
Usernames (i.e. the
NAME
property value) are the unique identifier of the user object in Snowflake while login names (i.e. theLOGIN_NAME
property value) are used to authenticate to Snowflake. Usernames are not sensitive data and are returned by other commands and functions (e.g. SHOW GRANTS). Login names are sensitive data.As a best practice, username and login name values should be different. To update existing username or login name values, execute the ALTER USER command. When creating new users with the CREATE USER command, ensure that the
NAME
andLOGIN_NAME
values are different.
Examples¶
Return all user names for the current account.
select all_user_names(); +---------------------------+ | ALL_USER_NAMES() | +---------------------------+ | [ "user1", "user2", ... ] | +---------------------------+
Return all user names for a specified account.
select all_user_names('my-account'); +------------------------------+ | ALL_USER_NAMES('MY-ACCOUNT') | +------------------------------+ | [ "user1", "user2", ... ] | +------------------------------+