COMMENT
statementsupportedDatabases & schemasAdds 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
supportedpartialnot supportednot scored
COMMENT [ IF EXISTS ] ON <object_type> <object_name> IS '<string_literal>';
COMMENT [ IF EXISTS ] ON COLUMN <table_name>.<column_name> IS '<string_literal>';
Parameters
| Name | Required | Description |
|---|---|---|
ON object_type object_name | Adds 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_name | Adds 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_literal | Specifies 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 COMMENT parameter in the CREATE <object> or ALTER <object> command.
- To modify an existing comment, specify the COMMENT parameter 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 COMMENT keyword (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.