My two cents ...

IMHO as a user I would like to have a command that does this internally, we may not expect users
to write joins on system tables.


~ Shreyas

Satheesh Bandaram wrote:

You can write a simple query, joining syscolumns and systables, as follows:

ij> create table test(i int, f float, c char(20), v varchar(255), b varchar(10) for bit data);
0 rows inserted/updated/deleted
ij> select cast(c.columnname as varchar(20)) columnname, c.columnnumber, c.columndatatype
from sys.syscolumns c where referenceid in (select tableid from sys.systables t,sys.sysschemas s
where tablename='TEST' and s.schemaid=t.schemaid and schemaname='APP');
COLUMNNAME |COLUMNNUMB&|COLUMNDATATYPE
------------------------------------------------
B |5 |VARCHAR (10) F&
C |3 |CHAR(20)
F |2 |DOUBLE
I |1 |INTEGER
V |4 |VARCHAR(255)


5 rows selected

It is possible to put the query in a view or a procedure and get required values from there. Of course, it would be easier if Derby were providing using a statement like DESCRIBE, but each database vendor seems to have their own way here.

Satheesh

Bernd Ruehlicke wrote:

Add a JIRA
(http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10594) to
the Derby and let people vote for it.

B-)



-----Original Message-----
From: Jonathan Eric Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, February 10, 2005 2:57 PM
To: Derby User List
Subject: Equivlent to MySQL DESCRIBE statement?


Does anyone know if Derby has an equivalent to the MySQL DESCRIBE statement? In MySQL, you can issue a command like the following to find out the structure of a table. i.e. list the columns, types, indexes, etc.

DESCRIBE <tableName>;

Jon








Reply via email to