简体   繁体   中英

List of fact table which has a specific column

I am looking for a way to find all the fact tables which has a specified column name. Is there any way we can find that? or the only way is to manually look into one table after the other?

For Instance, think of it like a Column Name: Claim_Id how do I find all the fact tables that has this column name within it?

select schema_name(tab.schema_id) as schema_name,
tab.name as table_name, 
col.column_id,
col.name as column_name, 
t.name as data_type,    
col.max_length,
col.precision
from sys.tables as tab
   inner join sys.columns as col
       on tab.object_id = col.object_id
   left join sys.types as t
      on col.user_type_id = t.user_type_id
WHERE COL.name='UpdatedDate'
order by schema_name,table_name,column_id;

You can use something like that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM