Results 1 to 2 of 2

Thread: Auto Gen Id Key

  1. #1
    Join Date
    Jun 2012
    Posts
    8

    Auto Gen Id Key

    I have a table that has one column which will contain unique data. The column is a varchar(100). The data will stay below 1000 rows. Should I use that column as the primary key OR should I create another column called id that is an int and auto gen as the primary key?

    Thanks for help.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    For under a thousand rows, performance is a non-issue. The engine will likely table-scan regardless of what indexes you have.
    So your two considerations are data integrity and design consistency.
    If you need to enforce uniqueness, you should do so on the natural key, regardless of whether you also use a surrogate key.
    If you want to have consistent table design, then make the same natural/surrogate key choice you have made with your other tables.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •