Question

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 :/

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top