Add comment on a COLUMN or TABLE

Database
Enthusiast

Add comment on a COLUMN or TABLE

Hi,

I'm trying to add a comment whithin the CREATE TABLE ddl. I've check that Teradata supports comments  via statements of the type:

COMMENT ON COLUMN table.col 'A comment!'

but the problem is SQL Assistand doesn't "visualize" them when I get the table ddl from the "Show Definition" menu.

My question is there a tricky way to add such comments to columns/tables, so they stay bounded to the table DDL?!

Something like the MySQL comment clause:

CREATE TABLE test(
id INT COMMENT 'This is the ID!'
)
Tags (4)
5 REPLIES
Enthusiast

Re: Add comment on a COLUMN or TABLE

if you just need it in the query then use double hypen to put comments

ct dummy(

int a --value of a

,int b -- value of b

)

But make sure, the comma has to be on the next line :-). .

Regards,

Mohan K

Enthusiast

Re: Add comment on a COLUMN or TABLE

I've just realized that adding regular comments will do the trick.

CREATE TABLE test(
id INT /* This is the ID! */
)
New Member

Re: Add comment on a COLUMN or TABLE

How can I query the table/column comments?  Would like a query for tables & columns:  schema, table, column, comments  and schema, table comments.

Tags (1)
Senior Apprentice

Re: Add comment on a COLUMN or TABLE

CommentString column is part of dbc views like ColumnV, TablesV & DatabasesV

Teradata Employee

Re: Add comment on a COLUMN or TABLE

If you use COMMENT ON, then you can select from views dbc.TablesV and dbc.ColumnsV, or use the HELP statement.