• david_a_wallace (8/27/2012)


    Thanks for your help.

    The problem I have with using IDs as keys is the user will see the IDs instead of the text on the main forums and would not be able to see where it was being moved from or to.

    Would the design be OK if the user could not change the primary keys?

    That seems a bit odd but I don't know how you are using it. The point of a primary key is to uniquely identify a row. If a user is allowed to change the value of the primary key then it is probably not a good choice as the primary key. In general, you should not design your database around how users will view it. Seems to me the code that displays your data should be changed.

    I can't completely tell because the code you posted originally did not contain all the tables but you have a foreign key to CustomerName. This is not a good idea at all. That type of schema can't handle two Customers with the same name. John Smith. There appears to be a lot of normalization issues in the tables you posted. Once you start coding lots of foreign key constraints with cascading updates you need to step back and look at your normalization. Why are you keys changing so much? The most logical answer there is that the columns you have chosen as primary keys are not a good choice.

    _______________________________________________________________

    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/