• crux1187 (9/18/2012)


    Okey before I try it out I have a question regarding your answer. When you set the Delete Rule constraint to Set Default, the default value in the column in the child table should exist somewhere in the parent?Is it the concept of Set Default?

    No that is how foreign keys work. You could make your column have a default but if that default does not exist in the parent table it will not work. I think you understand the concept of how it works but it is important to know that the default will violate the foreign key constraint when the default value does not exist.

    _______________________________________________________________

    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/