I've been creating a database in derby/netbeans. And I'd like to output the structure of the database, not just exporting the whole database. How do I do this?
I've tried both "EXEC 'table name';" which returned "Error code -1, SQL state 42X01: Syntax error: Encountered "exec" at line 1, column 1." and "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'table name';" which returned "Error code -1, SQL state 42Y07: Schema 'INFORMATION_SCHEMA' does not exist".
I've read on multiple forums that this should work, do you guys have any idea what I'm doing wrong?
GET TABLE STRUCTURE
select COLUMNNAME,COLUMNDATATYPE
FROM sys.systables t, sys.syscolumns
WHERE TABLEID = REFERENCEID and tablename = 'FRIENDS'
Other fields you can use in select
Inside Netbeans
Expand the Tables node under the sample database connection, right-click the table node and choose Grab Structure.
In the Grab Table dialog that opens, specify a location on your computer to save the grab file that will be created. Click Save.
The grab file records the table definition of the selected table. Expand the APP schema node under the Contact DB database connection, right-click the Tables node and choose Recreate Table to open the Recreate Table dialog box.
In the Recreate Table dialog box, navigate to the location where you saved the CUSTOMER grab file and click Open to open the Name the Table dialog box.
GET TABLES
A complete list.
select * from SYS.SYSTABLES;
Only TABLENAME
select TABLENAME from SYS.SYSTABLES where TABLETYPE='T'
Derby Table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With