Problems with Primary Key

  • I can't seem to set one of my varchar() columns as a primary key. Sql server is only letting my set int columns as primary keys. Also I can't seem to create relationships based on varchar columns. When I try to create relationships, the only columns they let me select are the ones that are int. Has anyone experience this.

    Please help...I don't need this right now.

  • Are you getting an error message? If so, what? How are you trying to set the primary key?

    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
  • Did you allready fill your table with data?

    If so, are the values in the varchar() column unique? --> required for PK!!

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • You'll also want to make sure that the columns you are trying to make part of the Primary Key are defined as NOT NULL. You can't have NULL columns be part of a Primary Key.

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

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