If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > help with alter table statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-04, 11:57
punchbowl punchbowl is offline
Registered User
 
Join Date: Mar 2004
Posts: 1
help with alter table statement

I'm trying to modify a primary key that already exists. I need to add another field to that primary key constraint. What would the syntax be?

currently:
primary key (product, location) constraint prodloc1
Reply With Quote
  #2 (permalink)  
Old 03-15-04, 22:07
lloydnwo lloydnwo is offline
Registered User
 
Join Date: Aug 2003
Location: India
Posts: 262
Re: help with alter table statement

Quote:
Originally posted by punchbowl
I'm trying to modify a primary key that already exists. I need to add another field to that primary key constraint. What would the syntax be?

currently:
primary key (product, location) constraint prodloc1
Hi there,

First you will have to drop the existing constraint & then create a new one.

Alter table <tabname>
drop constraint prodloc1;

Alter table <tabname>
add constraint primary key (column1, column2);


Regards,

Lloyd
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On