COMMENT statement

Use this statement to store a comment for a database object in the system tables.

Syntax
COMMENT ON {
    COLUMN [ owner.]table-name.column-name
   | DBSPACE dbspace-name
   | EVENT [ owner.]event-name
   | EXTERNAL ENVIRONMENT environment-name
   | EXTERNAL OBJECT object-name
   | FOREIGN KEY [ owner.]table-name.role-name
   | INDEX [ [ owner.] table.]index-name
   | INTEGRATED LOGIN integrated-login-id
   | JAVA CLASS java-class-name
   | JAVA JAR java-jar-name
   | KERBEROS LOGIN "client-Kerberos-principal"
   | LOGIN POLICY policy-name
   | MATERIALIZED VIEW [ owner.]materialized-view-name
   | PRIMARY KEY ON [ owner.]table-name
   | PROCEDURE [ owner.]procedure-name
   | SERVICE web-service-name
   | TABLE [ owner.]table-name
   | TEXT CONFIGURATION [ owner.]text-config-name
   | TEXT INDEX text-index-name ON [ owner.]table-name
   | TRIGGER [ [ owner.]tablename.]trigger-name
   | USER userid
   | VIEW [ owner.]view-name
}
IS comment
comment : string | NULL
environment-name : 
JAVA
| PERL
| PHP
| CLR
| C_ESQL32
| C_ESQL64
| C_ODBC32
| C_ODBC64
Remarks

The COMMENT statement allows you to set a remark (comment) for an object in the database. The COMMENT statement updates remarks listed in the ISYSREMARKS system table. You can remove a comment by setting it to NULL. For a comment on an index or trigger, the owner of the comment is the owner of the table on which the index or trigger is defined.

You cannot add comments for local temporary tables.

The environment-name is one of JAVA, PERL, PHP, CLR, C_ESQL32, C_ESQL64, C_ODBC32, or C_ODBC64.

If you use the Database Documentation Generator to document your SQL Anywhere database, you have the option to include the comments for procedures, functions, triggers, events, and views in the output. See Documenting a database.

Permissions

Must either be the owner of the database object being commented, or have DBA authority.

Side effects

Automatic commit.

Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The following examples show how to add and remove a comment.

Add a comment to the Employees table.

COMMENT
ON TABLE Employees
IS 'Employee information';

Remove the comment from the Employees table.

COMMENT
ON TABLE Employees
IS NULL;

To view the comment set for an object, use a SELECT statement similar to the following. This example retrieves the comment set for the ViewSalesOrders view in the SQL Anywhere sample database.

SELECT remarks 
FROM SYSTAB t, SYSREMARK r 
WHERE t.object_id = r.object_id 
AND t.table_name = 'ViewSalesOrders';