In my SQL Server 2005 database I have created a table with several data fields. One of the fields is designated as a primary key. And another one is just a key.
I can easily set the first field as the primary key, but am not able to set the second field as being just a key field.
I perform these steps to set the primary key.
(1) Right click on the table name and then select 'Open Table Definition'
(2) I right click on the field in my data table and select 'Select Primary Key'
As I mentioned previously, to set another field up as just a key field, I am not able to do this. My choices are the following when I right click on the data field to be designated as the key field:
Set Primary Key, Insert Column, Delete Column,Relationships,Indexes/Keys,Full Text Index,XML Indexes, Check constraints,Properties.
None of these choices will allow me to set the field up as a key field.
Someone please help me out with this problem.
I'm not sure what you're asking for but I can make some guesses. A Primary Key uniquely identifies each record. Therefore there can only be a single primary key for a table. However, a PK can be composed of more than 1 field.
If, however, you have one field which is the key and a second field which contains unique values, then you will want the first field as the key and add an index or constraint for the second field.
HTH.
No comments:
Post a Comment