Differences between revisions 5 and 6
Revision 5 as of 2006-09-21 16:54:46
Size: 1358
Comment:
Revision 6 as of 2009-09-20 22:11:21
Size: 1368
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
The upcoming [http://wiki.apache.org/db-derby/TenTwoSnapshot 10.2 release] adds
[http://db.apache.org/derby/docs/dev/tools/rtoolsijcomrefshow.html show tables | views] and
[http://db.apache.org/derby/docs/dev/tools/rtoolsijcomrefdescribe.html describe] commands to {{{ij}}}.
The upcoming [[http://wiki.apache.org/db-derby/TenTwoSnapshot|10.2 release]] adds
[[http://db.apache.org/derby/docs/dev/tools/rtoolsijcomrefshow.html|show tables | views]] and
[[http://db.apache.org/derby/docs/dev/tools/rtoolsijcomrefdescribe.html|describe]] commands to {{{ij}}}.
Line 28: Line 28:
The {{{dblook}}} utility lets you extract the schema for a database or a table in that database. {{{dblook}}} is documented in the [http://db.apache.org/derby/docs/10.1/tools/ctoolsdblook.html ''Derby Tools and Utilities Guide''], which also provides handy [http://db.apache.org/derby/docs/10.1/tools/rtoolsdblookexamples.html examples]. The {{{dblook}}} utility lets you extract the schema for a database or a table in that database. {{{dblook}}} is documented in the [[http://db.apache.org/derby/docs/10.1/tools/ctoolsdblook.html|''Derby Tools and Utilities Guide'']], which also provides handy [[http://db.apache.org/derby/docs/10.1/tools/rtoolsdblookexamples.html|examples]].

This page lists various ways to output information about the columns in a table.

Using ij

If all you want is to output the column names, the query below executed in ij shows how to do that for a table named my_table:

ij> select * from my_table where 1=2;

You can obtain more details by querying the system catalogs. The query below outputs information about the columns in the SYS.SYSCONSTRAINTS table:

select columnnumber, columnname, columndatatype
    from sys.systables t, sys.syscolumns, sys.sysschemas s
    where tableid=referenceid and t.schemaid=s.schemaid
      and schemaname='SYS' and tablename='SYSCONSTRAINTS'
    order by columnnumber;

The upcoming 10.2 release adds show tables and describe commands to ij.

Using dblook

The dblook utility lets you extract the schema for a database or a table in that database. dblook is documented in the ''Derby Tools and Utilities Guide'', which also provides handy examples.

ListTableColumns (last edited 2009-09-20 22:11:21 by localhost)