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 |
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2009-04-10 : 14:18:50
|
| I did a Select FName, LName, Recno into New Table from Old TableThere are 796819 rowsI'm having a hard time adding the primary keys because it's timing out. How can I add two primary keys to this table? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-04-10 : 14:39:40
|
| A table can only have one primary key. Do you mean you're creating a primary key with 2 columns? |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2009-04-10 : 14:46:19
|
| Yes that's what I need a primary key on two columns. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-04-10 : 15:31:41
|
| ALTER TABLE NewTable ADD CONSTRAINT PK_NewTable PRIMARY KEY(Col1, Col2)Books Online has more details under ALTER TABLE. Make sure all columns in the key are defined NOT NULL. |
 |
|
|
JJ297
Aged Yak Warrior
940 Posts |
Posted - 2009-04-10 : 15:51:04
|
| Great thanks! |
 |
|
|
|
|
|