COMMENT Examples | SQL Statements | Teradata Vantage - COMMENT Examples - Advanced SQL Engine - Teradata Database

SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
vjt1596846980081.ditamap
dita:ditavalPath
vjt1596846980081.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantageā„¢

Example: Retrieving a Comment

Suppose you have placed the following comment describing the name column in the employee table:

     COMMENT ON COLUMN employee.name
       IS 'Employee name, last name followed by first initial';

The following request retrieves this comment:

     COMMENT ON COLUMN employee.name;

The request returns the comment string as created by the previous request:

     Employee name, last name followed by first initial

Note that because the object kind for this request is COLUMN, you must specify the keyword COLUMN when you code it.

Example: Placing a Comment

Suppose you have defined a hash index named ord_hidx defined on the orders table, which is contained in the accounting database.

Because the object kind for this request is TABLE, representing a hash index, you are not required to specify TABLE in the request.

You could type the following comment-placing COMMENT request to define a comment on the hash index ord_hidx:

     COMMENT accounting.ord_hidx AS 'hash index on Orders';

Then if you were to perform the following comment-retrieving COMMENT request, the text that follows would be returned to you:

     COMMENT accounting.ord_hidx;
     
     hash index on orders