Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Question Unanswered: DateTime as Primary Key

    I've seen using integer or uniqueidentifier as primary key.
    But is it good or bad to use DateTime column as primary key?
    And why?

    Thanks

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    If you insert multiple records simultaneously, they may all end up with the same datetime value.

    ...and there goes your unique primary key...
    If it's not practically useful, then it's practically useless.

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

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    actually, the unique primary key doesn't go anywhere

    it's the multiple inserts that will go away (i.e. be rejected)

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    And you'll create potential hotspots
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

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