xorpower
xorpower

Reputation: 19003

SQL Script to know join relationship between FACT & Dimension Table

I have working in data warehouse project that uses MS-BI as its technology stack. The database contains Dimensions and fact tables but I would like to know the joining column between dimension and fact table. Is there any sql script that could find the joining column between dimension and the fact table?

Thanks

Upvotes: 1

Views: 1632

Answers (2)

emad
emad

Reputation: 73

Data Warehouse database is a database like none data warehouse database and you can get list of relations by using system tables such as sys.foreign_keys and also can get columns of each relation by using sys.foreign_keyColumns.

Upvotes: 1

mehdi lotfi
mehdi lotfi

Reputation: 11591

You can use following query in order to get all foreign key between each fact table and dimension table in your data warehouse.

SELECT * FROM sys.foreign_keys
SELECT * FROM sys.foreign_key_columns

Upvotes: 1

Related Questions