community.borland.com
Article #25380: Listing column names in an InterBase table
Problem:
What is the SQL command to get the column names for a specific table in an InterBase database?
Solution:
/*******************************************************************************/
Note: The information in this article applies to
InterBase v5.x
/********************************************************************************/
Here is the syntax of the SQL command to get the names of
columns in the table:
select rdb$relation_name, rdb$field_name from rdb$relation_fields
where rdb$relation_name=
For example to find the columns in the "contacts" table, you could
issue the sql statement below:
select rdb$relation_name, rdb$field_name from rdb$relation_fields
where rdb$relation_name='CONTACTS'
This would result in a display like the following:
RDB$RELATION_NAME RDB$FIELD_NAME
=================== ===============================
CONTACTS LASTCONTACTDATE
CONTACTS CUSTOMER_NO
CONTACTS LAST_NAME
CONTACTS FIRST_NAME
CONTACTS COMPANY
CONTACTS PHONE
*********************************************************************
WARNING:
Do not forget to put the table name in single quotation marks. If you
forget, you will get an error like the following:
Statement failed, SQLCODE = -206
Dynamic SQL Error
-SQL error code = -206
-Column unknown
Interbase requires the single quotation marks around literal values.
Putting the quotation marks around the literal helps InterBase
to know that you are talking about a literal value and not
a column.
**********************************************************************
Last Modified: 26-SEP-00