JOIN sys.tables tab2 ON tab2.object_id = fkc. JOIN sys.columns col1 ON lumn_id = parent_column_id JOIN sys.schemas sch ON tab1.schema_id = sch.schema_id JOIN sys.tables tab1 ON tab1.object_id = fkc.parent_object_id JOIN sys.objects obj ON obj.object_id = fkc.constraint_object_id I would recommend using proper metadata views which happens to be sys.foreign_key_columns : Im following the official Microsoft tutorial on database fundamentals, which uses the Adventureworks DW2008 database. If we want to show the relationships between tables then using column names between tables is not a better idea.ĬREATE TABLE tab(id INT PRIMARY KEY, name INT) ĬREATE TABLE tab2(id2 INT PRIMARY KEY, name INT) I'm trying to wrap my head around some more advanced Power BI features and at the same time learn some much-needed SQL, and I thought this would be a cool place to start, so any help is much appreciated! It can also be found on, but the question remains unanswered. And that causes the following query to fail:ĭoes anyone know if it's possible to fuzzy match column names or taking different prefixes into account to make this work? The very same question has been asked directly to the youtube OP. The problem is that many of my columns have got similar content, but different column names with prefixes such as pk_ or fk_ depending on which tables they are located in. ![]() Now I'm trying to replicate that example using another database. Scenarios include Manufacturing, Sales, Purchasing, Product Management, Contact Management, and Human Resources. ![]() ![]() I've come across a video on youtube that describes How to Easily Map Your Database Schema in Power BI using the AdventureWorks database from Microsoft. The AdventureWorks OLTP database supports standard online transaction processing scenarios for a fictitious bicycle manufacturer (Adventure Works Cycles).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |