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

ALTER VIEW .. COMMENT

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

This statement allows for changing the comment associated with a view. It is an alias for the COMMENT ON VIEW statement

Dialect support

This example using jOOQ:

alterView("v").comment("new comment")

Translates to the following dialect specific expressions:

Aurora Postgres, Firebird, Hana, Postgres, Teradata, Trino, Vertica, YugabyteDB

COMMENT ON VIEW v IS 'new comment'

BigQuery

ALTER VIEW v SET OPTIONS (DESCRIPTION = 'new comment')

DB2, DuckDB, H2, HSQLDB, Oracle

COMMENT ON TABLE v IS 'new comment'

Snowflake

ALTER VIEW v SET COMMENT = 'new comment'

SQLServer

BEGIN TRY
  DECLARE @u varchar(max) = schema_name();
  EXEC sp_addextendedproperty 'MS_Description', 'new comment', 'schema', @u, 'view', 'v', DEFAULT, DEFAULT
END TRY
BEGIN CATCH
  EXEC sp_updateextendedproperty 'MS_Description', 'new comment', 'schema', @u, 'view', 'v', DEFAULT, DEFAULT
END CATCH

ASE, Access, Aurora MySQL, ClickHouse, CockroachDB, Derby, Exasol, Informix, MariaDB, MemSQL, MySQL, Redshift, SQLDataWarehouse, SQLite, Sybase

/* UNSUPPORTED */

(These are currently generated with jOOQ 3.20, 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