Subject | Re: [firebird-support] Creating / Altering Primary Keys on production tables |
---|---|
Author | Helen Borrie |
Post date | 2003-10-31T13:49:58Z |
At 07:14 PM 31/10/2003 +0530, you wrote:
add constraint pk_atable primary key(pk_id);
then
alter table atable
drop constraint rdb$primarynn <--- make sure you get the right one
commit;
alter table atable
add constraint........
h.
>Hi Everyone,alter table atable
>
>This may have been answered earlier ... but I seem to have some trouble
>accessing the archive ... so here goes
>
>I have a few tables created with no primary key defined. I now want to
>add a primary key to the specified tables. No change in datatypes or
>anything ... just adding simple primary keys to a few tables. How can I
>do it ?
add constraint pk_atable primary key(pk_id);
>Do I need to make the users log out completely ?Yes
>WhatNone
>precautions need to be taken apart from ensuring that the column
>definition is unique & not null.
>Also if a table has an existing primary key can I drop that to create aBackup.
>new primary key. The column which is to now become the primary key has
>no null values and values are unique but the constraints have not been
>put while defining the columns. Again what are the precautions.
then
alter table atable
drop constraint rdb$primarynn <--- make sure you get the right one
commit;
alter table atable
add constraint........
>I remember some talk about system tables and changing them in anotherWise man. I do understand how they work but I don't touch 'em.
>thread somewhere. Would prefer not to touch those coz I do not
>understand much about how they work anyways :-)
>I am using FB 1.0.2 - Are there any differences while using the olderFewer bugs. More bugs than FB 1.0.3. :-)
>versions.
h.