Hello Michael,

Wednesday, March 3, 2004, 1:40:00 PM, you wrote:

RM> I have a table, that has a primary key with two columns and want to add a
RM> third column to this primary key.

RM> Is this possible and when yes: Do I have to delete all tables, that
RM> reference to this table?
 
No, you don't have to delete all tables that reference this table.

You can drop the key:

ALTER TABLE tablename DROP PRIMARY KEY

and then re-create it:

ALTER TABLE tablename ADD PRIMARY KEY (a,b,c)

Please note that if you have a field with a property such as
"auto-increment" then dropping the primary key will fail because it
will leave an invalid table definition.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to