• gkramer 23701 (7/3/2015)


    One of our developers just steped into our office and asked why it is not possible to create a Foreign key to a Unique constraint ??

    It is possible. Unique indexes work fine as well. Where your developer probably made the mistake is in not having the foreign key on both columns of the unique constraint. If he tried to reference just on one, then he will get an error because the unique constraint is on two columns, not 1.

    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