Creates a new tag or replaces an existing tag in the system.
- See also:
CREATE [ OR REPLACE ] TAG [ IF NOT EXISTS ] <name> [ COMMENT = '<string_literal>' ] CREATE [ OR REPLACE ] TAG [ IF NOT EXISTS ] <name> [ ALLOWED_VALUES '<val_1>' [ , '<val_2>' , [ ... ] ] ]
Identifier for the tag. Assign the tag string value on an object using either a CREATE <object> statement or an ALTER <object> statement.
The identifier value 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.
For more details, see Identifier Requirements.
ALLOWED_VALUES 'val_1' [ , 'val_2' , [ ... ] ]
Specifies a comma-separated list of the possible string values that can be assigned to the tag when the tag is set on an object using the corresponding CREATE <object> or ALTER <object> command.
The maximum number of tag values in this list is 50.
Default: NULL (all string values are allowed, including an empty string value (i.e.
COMMENT = 'string_literal'
Specifies a comment for the tag.
Default: No value
Access Control Requirements¶
A role used to execute this SQL command must have the following privileges at a minimum:
Note that operating on any object in a schema also requires the USAGE privilege on the parent database and schema.
For instructions on creating a custom role with a specified set of privileges, see Creating Custom Roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
For additional details on tag DDL and privileges, see Managing Tags.
Snowflake limits the number of tags in an account to 10,000.
For more information on how tags can be associated to Snowflake objects, see Object Tagging.
For more information on tag DDL authorization, see required privileges.
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.
CREATE OR REPLACE <object> statements are atomic. That is, when the object is replaced, the old object deletion and the new object creation are processed in a single transaction.
Create a tag with the key
CREATE TAG cost_center COMMENT = 'cost_center tag';