Foreign Keys on Views RRS feed

  • Question

  • Hallo together,
    I have a short question. Is it right that in SQL Server 2005 it is not possible to define foreign keys on Views. If so I can not use an View as dimension table were I want to establish a parent-child-relationship on.

    If so I will establish a workaround were I use a Stored Procedure to get dbo.DimA and dbo.DimB from dbo.DimAandB. Because I need all three tables. So an view would be the best solution I found.

    And one short second question. Would it reasonable to use a view as fact table (what is of course not possible, if I cannot define foreign keys on a view). But if it would be possible.

    Thanks for any information and answers,
    Monday, June 8, 2009 9:00 AM


  • The answer to this question is Replace Table > With New Named Query.
    Within the Data Source View this can easily be establish.
    I now found the answer very quick. But perhaps someone will one day think in the wrong direction like me and perhaps this entry can help him find the answer quicker.
    • Marked as answer by Martin Brehm Monday, June 8, 2009 9:20 AM
    Monday, June 8, 2009 9:20 AM