Get list of column names from a Firebird database

2019-03-20 01:09发布

How do you get a list of the column names in an specific table?

ie.

Firebird table:

| name | id | phone_number |

get list like this:

columnList = ['name', 'id', 'phone_number']

1条回答
唯我独甜
2楼-- · 2019-03-20 01:49

if you want to get a list of column names in an specific table, this is the sql query you need:

select rdb$field_name from rdb$relation_fields
where rdb$relation_name='YOUR-TABLE_NAME';

I tried this in firebird 2.5 and it works.

the single quotes around YOUR-TABLE-NAME are necessary btw

查看更多
登录 后发表回答