View previous topic :: View next topic
|
Author |
Message |
prabahar
New User
Joined: 25 Nov 2005 Posts: 6
|
|
|
|
We need to add two new columns to an existing table. One of the new column has to be added to the composite primary key. The table already has a composite primary key. Can we alter the primary key and add the new column as a part of primary key.
Suggestios are welcome.
Regards,
Prabahar |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
Quote: |
Can we alter the primary key and add the new column as a part of primary key. |
Better u can drop the key and again add the same. |
|
Back to top |
|
|
senthilssg
New User
Joined: 09 Dec 2005 Posts: 64 Location: USA
|
|
|
|
Hi ,
1. first drop the primary key of the table .
2. after that drop the index on that table .
3. create new index for the table as per the requirement .
4. now using alter table statement
ALTER TABLE SSGSEN.TRIAL_TABLE
ADD PRIMARY KEY (field_name);
uou can add the primary key to the table .
I hope this help you
Regards,
Senthil |
|
Back to top |
|
|
prabahar
New User
Joined: 25 Nov 2005 Posts: 6
|
|
|
|
Thank you all for your timely help
Regards,
Prabahar |
|
Back to top |
|
|
|