none
TEXT TYPE COLUMN AS PRIMARY KEY??? RRS feed

  • Question

  • I am a totally new user of SQL Server Express. I want to have the Cust_ID (the primary key) be inserted manually (sample key is: 2010-01-Tax-00001). But when I set the type of data of Cust_ID column/field to Text, I find the Primary Key setting option disabled.

    Anyway out???

    Thanx again guys!

    Wish u all the best and best regards,

    FARAZ!

    Friday, March 19, 2010 7:31 AM

Answers

  • Hi Faraz,

    You can not set primary key to text and ntext columns. But you can achiveve the same functionality by setting datatype as a varchar(8000). The difference is this column can now contain at most 8000 chars.

    Ideally you should not use this datatype column as a primary key.

    Chintak,

    Friday, March 19, 2010 8:52 AM

All replies