• sdhamani1020 (6/11/2013)


    Keep getting this error :

    Error :

    Msg 1776, Level 16, State 0, Line 1

    There are no primary or candidate keys in the referenced table 'tbl_property' that match the referencing column list in the foreign key 'fk_Trace_num'.

    Msg 1750, Level 16, State 0, Line 1

    Could not create constraint. See previous errors.

    I have created two tables , and am trying to create a relationship but somehow keeps getting the above error.

    I have created a composite key in the table and now want to create a foreign key for that in another table.

    Kindly advise.

    Your table tbl_property does not have a primary key. You have to create one first.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/