Search code examples
stored-proceduresfirebirdinformation-schemafirebird1.5

stored procedure which solve me names of column of table


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


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