How to find a lookup table from a table column?

minh tran 216 Reputation points
2022-05-21T23:50:50.563+00:00

Hello,
I am new to the SQL Server Management Studio 18 , and I would like to seek your helps, and expertise on how to find a lookup table from a table columns.

For example I have a CurrencyRate table. In the currencyRate, I have a column name CurrencyKey. It is refer to as a FK to another table named CurrencyDim which has the currencyKey as a PK.

Supposely that I don't have any of the above information described teh relationship of those two above tables; I oonly have the CurrencyRate table. Is there a way for me to use either

  1. The SQL Server Management Studio tool if there is any tool to find out the relationship of other table from the CurrencyRate table?
  2. Is there q sql query that I can use to find out those relationship?

The reason is that I want to find out the relationship because I plan to learn to create a SSIS package which would need a lookup transformat to match the cotent of my text file data to the target table columns.

Thanks again for all of the helps.
Du

Developer technologies Transact-SQL
{count} votes

10 answers

Sort by: Most helpful
  1. minh tran 216 Reputation points
    2022-05-23T13:37:40.943+00:00

    Thank you so much for all of the help.
    I have one question regarding learning SSIS and I would like to seek your advice.

    Since I am a beginner using Visual Studio 2015 to learn the SSIS process package creating for datawarehouse,
    could you help point my to book or learning resources that I can learn on my own time?

    Thanks again for all of the wonderful helps.

    Du


  2. minh tran 216 Reputation points
    2022-05-27T15:55:46.937+00:00

    Good morning,
    I am so sorry for asking you again on the clarification of the script finding foreign key of the FactCurrencyRate table in the AdventureWork2019 database.

    Accoring to the diagram below, the FactCurrencyRate table has two foereign keys refer to the DimCurrency table and the DimDate table. So when I ran the script below , it should give me those two referenced tables and their primaky keys

    use AdventureWorksDW2019  
      
     select OBJECT_NAME(referenced_object_id)  
     FROM sys.foreign_key_columns  
     WHERE OBJECT_NAME(parent_object_id) = 'dbo.FACTCurrencyRate'  
     GO  
    

    However, it gave me none of the referenced tables and their primary keys when I ran the script above to find depencies of the FactCurrencyRate table.

    206304-capture.png

    Could you please help to suggest what I need to do in order to find the dependencies of the FactCurrency table because I need to use it in the Lookup Transformation for my learning of SSIS ?

    Thank you very much for the help.

    Du


  3. minh tran 216 Reputation points
    2022-05-27T18:38:25.357+00:00

    Thanks but it did not let me to see his solution.

    I tried to click on the link, and it gave me Bert Zhou-msft's profile is private.

    Is there a way for me to view his note?

    Thanks,
    Du


  4. minh tran 216 Reputation points
    2022-05-28T12:50:07.25+00:00

    May I ask how can I see his solution ?
    It did not let me to see his solution. It said his account is private.
    Thanks,
    Du


  5. minh tran 216 Reputation points
    2022-05-29T23:29:46.287+00:00

    Great. Thabk you so much


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.