COMMENT¶
Adds a comment or overwrites an existing comment for an existing object.
Comments can be added to all objects (users, roles, warehouses, databases, tables, and so on). You can also use this command to add comments to individual table columns, but not to constraints on columns.
Syntax¶
Parameters¶
ON object_type object_nameAdds a comment to the object of the specified type (for example,
TABLE,SCHEMA,VIEW, and so on) with the specified identifier.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.
For more information, see Identifier requirements.
ON COLUMN table_name.column_nameAdds a comment to the specified table column.
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.
For more information, see Identifier requirements.
IS string_literalSpecifies the comment to add.
Default:
NULL
Usage notes¶
You can also add or modify comments when you are creating or altering objects:
To add a comment, specify the
COMMENTparameter in the CREATE <object> or ALTER <object> command.To modify an existing comment, specify the
COMMENTparameter in the ALTER <object> command.
A slightly different syntax is used for adding or modifying comments on table columns:
To add a comment at creation, follow the column declaration with the
COMMENTkeyword (not property).To modify a comment, use this command.
To add a comment to a constraint, use the CREATE TABLE or CREATE | ALTER TABLE … CONSTRAINT commands.
The DESCRIBE TABLE output doesn’t show comments for table constraints, such as multi-column primary keys. To see these comments, query the TABLE_CONSTRAINTS view.
Regarding metadata:
Attention
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.
Examples¶
Create a schema with a comment, then overwrite the comment:
Create a table with a comment on a table column, then overwrite the comment:
Create a view with a comment, then overwrite the comment: