How to change the primary key for already existing table?
How to change the primary key for already existing table?
Collapse
X
-
sajithamolTags: None
-
Originally posted by sajithamolHow to change the primary key for already existing table?
You can do this with an "ALTER TABLE" command:
Suppose you had the following sample table with id as the primary key:
Code:create table mytest ( id int not null default 0, some_val in not null default 0, foo varchar(32), primary key (id));
Code:alter table mytest drop primary key; alter table mytest add primary key(id,some_val);
Rick
Comment