• I first focused on the reference to a unique constraint rather than the primary key, thinking that was the issue of the question. I almost got it wrong because of that, as I had first not given enough attention to the other details of the code.

    I guess that many people will get this question right for the wrong reasons. (Many people think that a foreign key should always reference the primary key).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/