Is there a way to get a column remarks from a table

38 views
Skip to first unread message

George Ivanov

unread,
Jun 11, 2020, 9:20:43 AM6/11/20
to H2 Database
hi all,

i'd like to get columns remarks from a table and insert those as a row into the table. Is that possible?

So, if I had a MYTABLE of columns "A" and "B", and I have remarks for those columns in the schema, I would like to put the remarks as follows

INSERT INTO MYTABLE VALUES(<remarks for A>, <remarks for B>);

I know I can get the remarks directly from schema:
SELECT COLUMN_NAME, REMARKS 
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE REMARKS <> '' AND TABLE_NAME = 'MYTABLE';

But, it looks, this will not help me to insert the remarks.
Any ideas?
Thank you!

Evgenij Ryazanov

unread,
Jun 11, 2020, 12:27:23 PM6/11/20
to H2 Database
Hello.

Subqueries with exactly one row can be used as expressions.

INSERT INTO MYTABLE VALUES ((SELECT REMARKS FROM … WHERE TABLE_NAME = … AND COLUMN_NAME = 'A'), (SELECT … WHERE …));

George Ivanov

unread,
Jun 12, 2020, 6:05:07 PM6/12/20
to H2 Database
Evgenij, thank you!
Reply all
Reply to author
Forward
0 new messages