Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-01-19 : 09:50:50
|
| Murali writes "There is a table of 39 fields. For this table the unique ness is coming with the combination of 10 fields.Kindly suggest me which is the best way to do?1.Should I make the Primary key using the combination of all the 10 fieldsor2.Should I introduce one more field and make it as Primary key. Then put the unique constraint for all the 10 fields.Assumptions:(For the following both cases seperately)1.Assuming the table as independent.2.Assuming the table as dependent i.e., it has to be linked with the other tables." |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2004-01-19 : 10:07:30
|
| If you'll have to use it as a parent table, add a column (as primary key), if it is a stand alone table use the 10 column unique index.But remember that this is only a suggestion, it all depends on the purpose of the table... |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-01-19 : 12:50:34
|
| Are you asking whether or not to put the primary key on the 10 columns or add an identity column that would be the primary key?Tara |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-01-19 : 13:04:20
|
| What are the fields?If they are non-updateable and don't cause significant processing problems by being used in joins (i.e. are not wide) then make them the PK.If either of these is not true then create an artificial field.If the new field is created for the second test then I would leave the compound fields as the PK and the new field as an alternate key for joins. If for the first then make the new field the PK and the second the alternate.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|