Duplicate Primary Keys - How to Handle ??

  • I have a situation where i know i am going to have duplicate primary keys ?

    I want to allow duplicate records.

    What is the best way to handle this ?

    Thanks

  • Can't you find a better primary key to suit your needs? Can you explain your situation with DDL and sample data?

    Cheers,

    J-F

  • ifila (5/12/2009)I have a situation where i know i am going to have duplicate primary keys ?

    I want to allow duplicate records.

    Your PK definition is wrong; you either allow or do not allow duplicates... can't have it both ways.

    Either define a real PK and drop the one you have now or just drop the one you have now.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • I created a workaround solution and used the system record counter to generate my primary key.

    Thanks

  • Even if I'm not a big fan of surrogate keys I can understand they come handy from time to time.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply