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)