Describe DB Objects (Tables, etc)

928 views
Skip to first unread message

smartini

unread,
Mar 2, 2009, 6:44:53 AM3/2/09
to H2 Database
Hi to all,
is it possible in H2 to show the structure (maybe in SQL) of a given
object, but without seeing or exporting the structure of all the DB
(script nodata) ?

The best could be to add additional (optional) arguments like
object_type (table, view, domain, etc) and then the object name (with
optional wildchars, but also on a single object could be useful). Or a
dedicated command, like SHOW ... as over.

For example, Oracle has a SQL command DESC / DESCRIBE object_type
object_name , like: describe table samples
But Oracle doesn't return the SQL DDL of the given objects, it returns
only a summary text with most common features.

What do you think ?

Thanks,
Sandro

Thomas Mueller

unread,
Mar 4, 2009, 12:59:28 PM3/4/09
to h2-da...@googlegroups.com
Hi,

> is it possible in H2 to show the structure (maybe in SQL) of a given
> object, but without seeing or exporting the structure of all the DB
> (script nodata) ?

The 'standard' was is to use the information_schema tables.

> Or a dedicated command, like SHOW ... as over.

Actually this is supported, but not documented so far. I will add the
following documentation:

SHOW { SCHEMAS | TABLES [FROM schemaName] |
COLUMNS FROM tableName [FROM schemaName] }

Lists the schemas, tables, or the columns of a table.

Examples:
SHOW SCHEMAS;
SHOW TABLES;
SHOW COLUMN FROM TEST;

Regards,
Thomas

smartini

unread,
Mar 13, 2009, 10:53:02 AM3/13/09
to H2 Database
Hi Thomas,
thanks for your help, I'll try the commands ...

Best regards,
Sandro
Reply all
Reply to author
Forward
0 new messages