views:

35

answers:

1

Hey,

I need a stored procedure which in parameter have name of table(varchar) and it return names of columns in this specific table.

It is possible ? I think about some SELECT which retrieve this names from table but I am weak at SQL :/

I add that I use Firebird 1.5 :/

+1  A: 

You don't need stored procedure. Just a simple request can make this :

SELECT r.RDB$FIELD_NAME AS field_name
FROM RDB$RELATION_FIELDS r WHERE
r.RDB$RELATION_NAME='TABLE_NAME' --table name 
ORDER BY r.RDB$FIELD_POSITION;

you can learn more here : http://www.alberton.info/firebird_sql_meta_info.html

Hugues Van Landeghem