I have a table - suppose it is called company:
CREATE TABLE ( company_id char(36) NOT NULL UNIQUE PRIMARY KEY,
.
.
.
);
I want to add the following field:
company_nemonic char( 3 ) NOT NULL UNIQUE
Well, ALTER TABLE only gets me part of the way there. While this code
successfully adds the table:
ALTER TABLE
company
ADD COLUMN
company_nemonic char( 3 ) NOT NULL UNIQUE;
the constraints are ignored.
Is there an easy way to add the constraints after the fact?
I have resorted to creating a company_temp table, insert into company_temp
selecting from company, dropping company and then renaming company_temp to
company. This works, but causes another problem. The index for the unique
key company_temp_pkey does not get renamed with the table. This means if I
ever want to do something like this again, the create of company_temp will
fail because company_temp_pkey already exists.
Any help would be much appreciated.
_______________________________________
John Pagakis
DevelopOnline.com
480.377.6828
<<John Pagakis.vcf>>