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

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

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