Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

COMMENT ON COLUMN

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

This statement is used to comment on a column.

Dialect support

This example using jOOQ:

commentOnColumn(name("table", "column")).is("the comment")

Translates to the following dialect specific expressions:

-- AURORA_POSTGRES, COCKROACHDB, DB2, EXASOL, FIREBIRD, H2, HANA, HSQLDB, MARIADB, ORACLE, POSTGRES, TERADATA, TRINO, 
-- VERTICA, YUGABYTEDB
COMMENT ON COLUMN table.column IS 'the comment'

-- SNOWFLAKE
ALTER TABLE table ALTER COLUMN column COMMENT 'the comment'

-- SQLSERVER
BEGIN TRY
  DECLARE @u varchar(max) = schema_name();
  EXEC sp_addextendedproperty 'MS_Description', 'the comment', 'schema', @u, 'table', 'table', 'column', 'column'
END TRY
BEGIN CATCH
  EXEC sp_updateextendedproperty 'MS_Description', 'the comment', 'schema', @u, 'table', 'table', 'column', 'column'
END CATCH

-- ACCESS, ASE, AURORA_MYSQL, BIGQUERY, DERBY, DUCKDB, INFORMIX, MEMSQL, MYSQL, REDSHIFT, SQLDATAWAREHOUSE, SQLITE, 
-- SYBASE
/* UNSUPPORTED */

(These are currently generated with jOOQ 3.19, see #10141), or translate your own on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo