Subject | Error while attempting to add a Primary key to a table that has no records |
---|---|
Author | stwizard |
Post date | 2015-10-01T21:04:22Z |
Greetings,
Firebird v2.5.4
I use Database Workbench v 5 as my database development tool.
I have this table which is currently empty (0 rows). It originally had a primary key on TRUST_STATEMENT_ID and ORIGINAL_PMT_ID
CREATE TABLE TRUST_STATEMENT_PMT_BACKOUT_CHK
(
TRUST_STATEMENT_ID INTEGER NOT NULL,
ORIGINAL_PMT_ID INTEGER NOT NULL,
ORIGINAL_ACCT_ID INTEGER NOT NULL,
ORIGINAL_CASE_ID SMALLINT NOT NULL,
ORIGINAL_DEBT_NO SMALLINT NOT NULL,
ORIGINAL_PMT_NO SMALLINT NOT NULL,
ORIGINAL_PMT_DATE DATE NOT NULL,
ORIGINAL_PMT_AMT NUMERIC( 15, 2) NOT NULL,
BACKOUT_PMT_ID INTEGER,
BACKOUT_PMT_NO SMALLINT,
BACKOUT_PMT_DATE DATE,
BACKOUT_PMT_AMT NUMERIC( 15, 2)
);
I drop the PK so I could add 3 new fields (ORIGINAL_ACCT_ID, ORIGINAL_CASE_ID and ORIGINAL_DEBT_NO) to this table.
Now I’m trying to add a primary key on TRUST_STATEMENT_ID, ORIGINAL_PMT_ID, ORIGINAL_ACCT_ID, ORIGINAL_CASE_ID and ORIGINAL_DEBT_NO
But I receive this error:
validation error for column ORIGINAL_ACCT_ID, value "*** null ***"
while executing:
ALTER TABLE TRUST_STATEMENT_PMT_BACKOUT_CHK
ADD CONSTRAINT PK_TRUST_STATEMENT_PMT_BACK PRIMARY KEY (TRUST_STATEMENT_ID, ORIGINAL_PMT_ID, ORIGINAL_ACCT_ID, ORIGINAL_CASE_ID, ORIGINAL_DEBT_NO)
Why am I receiving this error and how do I fix it?
Mike