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 |
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-10-19 : 03:08:03
|
| Would you mind explaining me below:I can make three primary keys in a table likeCREATE TABLE ORDER (order_id bigint NOT NULL,product_id int NOT NULL,order_date datetime NOT NULL,price decimal(21,2) NOT NULL,———– columns —————PRIMARY KEY (order_id, product_id, order_date))GOWELL, i can see three PK’s in SQLMS. Are these really 3 Pk’s or 1 PK or 2 composite keys?As we create PK, we create an automatic Clustered index on the PK column.What would be in this case?Would there be 3 Clustered indexes here?When i created this table and checked out the script by SQL server, i got script seems to have clustered index on a table instead of 3 above mentioned columns, so what does it mean?i will appreciate your help..ThanksGaneshSolutions are easy. Understanding the problem, now, that's the hard part |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-19 : 03:18:56
|
| Its not 3 PKs but 1 composite PK consisting of columns order_id, product_id, order_date.There would be a single clustered index on table on three columns together. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-19 : 03:21:02
|
| also see thishttp://msdn.microsoft.com/en-us/library/aa933131(SQL.80).aspx |
 |
|
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2008-10-19 : 03:50:12
|
| Thank you visakh, i will have a look into your URL.Solutions are easy. Understanding the problem, now, that's the hard part |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-19 : 04:08:15
|
quote: Originally posted by ganeshkumar08 Thank you visakh, i will have a look into your URL.Solutions are easy. Understanding the problem, now, that's the hard part
welcome |
 |
|
|
|
|
|
|
|