Name: COMMENT ON Shortest: COMME ON
Family: Command Category: Data Definition
Description: Use the COMMENT ON command to add a description to a table or column.

Syntax

COMMENT ON syntax diagram

Options

colname
Adds a description for a column in all tables in which it appears.

DELETE
Removes a description for a table or for a column in either the specified table or in all tables.

IN tblname
Adds a description for a column only in the specified table.

IS 'description'
Defines a description for a table or for a column in either the specified table or in all tables. The text must be enclosed in quotes using the current QUOTES setting.

TABLE tblname
Adds a description for the specified table.

VIEW viewname
Adds a description for the specified view.

tblname.colname
Specifies a 1 to 18 character column name. In a command, you can enter #c, where #c is the column number shown when the columns are listed with the LIST TABLES command. In an SQL command, a column name can be preceded by a table or correlation name and a period (tblname.colname).

About the COMMENT ON Command

A COMMENT ON description can be a maximum of 80 characters. If the description is longer, R:BASE displays only the first 80 characters. Descriptions must be enclosed in single quotation marks ('), or the current delimiter character for QUOTES.

When you add a description to a column that appears in multiple tables, R:BASE adds the description to the column in every table. If you add a new table containing the column, you must add the description for that column to the new table.

Use the LIST command to list the descriptions of the tables and columns. R:BASE also displays the description when you modify a table using the Database Designer. Comments are stored in thesys_comments system table. When a column or table is renamed or removed, R:BASE automatically updates the sys_comments table to reflect the change.

When access rights for a table have been assigned using the GRANT command, COMMENT ON requires the database owner's user identifier to describe tables and columns.

Examples

The following command adds a description to the employeetable.

COMMENT ON TABLE employee IS 'employee information'

The following command adds a description to the empid column in all tables in the database.

COMMENT ON empid IS 'employee identification number'

The following commands show two ways to add a description to the empid column in only the employee table.

COMMENT ON employee.empid IS 'employee identification number'
COMMENT ON empid IN employee IS 'employee identification number'

The following command removes the description from the employeetable.

COMMENT ON TABLE employee DELETE

The following command removes the description from the empidcolumn in every table in which the column occurs.

COMMENT ON empid DELETE

The following command removes the description from the empidcolumn in the employee table.

COMMENT ON empid IN employee DELETE