zeoran zeoran - 1 year ago 64
SQL Question

how to get table name and a particular column ordinal position in entire database

I have a PostgreSQL 9.3 database called

, It contains 150 tables most of the tables in
have column called

So my question is How can I get table name and the column- product ordinal position in my

Answer Source
SELECT table_name,column_name,ordinal_position 
FROM   information_schema.columns  
WHERE  table_catalog = 'dbSales' and column_name = 'product'

The information schema consists of a set of views that contain information about the objects defined in the current database.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download