6

我正在向表中添加一些新列,并希望将文档添加到表 DDL 中以供未来的开发人员使用。怎么办?

4

2 回答 2

7

通用语法:

COMMENT ON {OBJECT} {OBJECTNAME} AS '{255 characters of text};

详细语法示例:

COMMENT ON TABLE {DATABASE}.{TABLENAME} AS '{255 characters of text}';
COMMENT ON COLUMN {DATABASENAME}.{TABLENAME}.{COLUMNNAME} AS '{255 characters of text}';
COMMENT ON USER {USERNAME} AS '{255 characters of text}';
COMMENT ON DATABASE {DATABASENAME} AS '{255 characters of text}';
于 2013-02-12T15:16:25.633 回答
3

除了添加对象注释之外,您还可以添加内嵌注释来查看定义。由于大多数访问总是通过视图,这就是我们与负责表和文档更改的 DBA 沟通的方式。例如:

replace view VIEWDB.vmy_table as
locking DATADB.my_table for access
select *
from  DATADB.my_table
/* This is a comment */
/* Created by Bob */

这种技术的好处是,当您执行SHOW SELECT * FROM VIEWDB.vmy_table.

于 2013-02-12T20:20:59.420 回答