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.
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.
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.
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.
+-------------------------------+-----------+------------+------------+---------------+---------+--------------+---------+----------------+-----+| created_on |name| is_default | is_current |database_name|owner|comment| options | retention_time |...||-------------------------------+-----------+------------+------------+---------------+---------+--------------+---------+----------------+-----+|2025-02-2612:08:52.363-0800| MY_SCHEMA | N | Y | MY_DB | MY_ROLE | now comment2 ||1|...|+-------------------------------+-----------+------------+------------+---------------+---------+--------------+---------+----------------+-----+
Create a table with a comment on a table column, then overwrite the comment:
CREATEORREPLACETABLE test_comment_table_column(my_column STRINGCOMMENT'this is comment3');DESCTABLE test_comment_table_column;
+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+------------------+-------------+----------------+|name|type|kind|null?|default|primarykey|uniquekey|check| expression |comment|policyname|privacydomain||-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+------------------+-------------+----------------|| MY_COLUMN |VARCHAR(16777216)|COLUMN| Y |NULL| N | N |NULL|NULL| this is comment3 |NULL|NULL|+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+------------------+-------------+----------------+
+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+--------------+-------------+----------------+|name|type|kind|null?|default|primarykey|uniquekey|check| expression |comment|policyname|privacydomain||-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+--------------+-------------+----------------|| MY_COLUMN |VARCHAR(16777216)|COLUMN| Y |NULL| N | N |NULL|NULL| now comment4 |NULL|NULL|+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+--------------+-------------+----------------+
Create a view with a comment, then overwrite the comment:
CREATEORREPLACEVIEW test_comment_view COMMENT='this is comment5'AS(SELECT*FROM test_comment_table_column);SHOWVIEWSLIKE'test_comment_view';
+-------------------------------+-------------------+----------+---------------+-------------+---------+------------------+-----+| created_on |name| reserved |database_name|schema_name|owner|comment|...||-------------------------------+-------------------+----------+---------------+-------------+---------+------------------+-----+|2025-02-2612:38:35.440-0800| TEST_COMMENT_VIEW || MY_DB | MY_SCHEMA | MY_ROLE | this is comment5 |...|+-------------------------------+-------------------+----------+---------------+-------------+---------+------------------+-----+