How many types of integer primary keys we can give?

  • How many types of integer primary keys we can give?

    Thanks,

    Rams

  • ramana 45417 (2/13/2011)


    How many types of integer primary keys we can give?

    Thanks,

    Rams

    This will sound strange but the answer is... "All of them". Every integer type can be used as a Primary Key.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • As far as I'm aware, all indexable data types can be used as primary keys. Some just make less sense than others.

    Can you clarify the question maybe? I don't think we're fully understanding what you want.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • But, you only get one primary key per table. You can have multiple unique keys, but only one primary key.

    I'm with everyone else, what exactly are you looking for here.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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