Setting referential integrity across distinct databases

  • Is it possible to set referential integrity between two tables which are part of different databases?

    For ex:

    suppose dim_calendar table with Time_Key as primary key is in database A

    fact_sales with period_key as foreign key is in database B

    then is it possible that B.fact_sales(period_key) references A.dim_calendar(time_key)?

    Thanks

  • No.Cross database foreign key reference is not supported.

    ..

  • You'll need to use triggers to do this.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply