Subject | Re: [firebird-support] Foreign Key and NOT NULL |
---|---|
Author | Helen Borrie |
Post date | 2003-11-17T13:49:19Z |
At 03:39 PM 17/11/2003 +0200, you wrote:
Unfortunately, you cannot remove a NOT NULL constraint. You have to create
a new temporary column *without* the constraint, commit, copy the data from
OwVBSQ into it, commit, drop OwVBSQ, commit, create OwVBSQ without the
constraint, commit, copy the data from the temp col into OwVBSQ,
commit; then drop the temp column.
heLen
>When moving data from Paradox tables to firebird. I always get an INTEG_23NOT NULL means "NULL is not permitted". That's why you get the error. :-)
>constrating error on the following table:
>
>CREATE TABLE Owner /* Wp */
>(
>OwIDSQ INTEGER NOT NULL ,
>CityVBSQ INTEGER NOT NULL ,
>OwVBSQ INTEGER ,
>OwName VARCHAR(120) NOT NULL ,
>
>PRIMARY KEY (OwIDSQ) ,
>FOREIGN KEY (CityVBSQ) REFERENCES City (CityIDSQ) ON DELETE CASCADE ,
>FOREIGN KEY (OwVBSQ) REFERENCES Whitepage (OwIDSQ) ON DELETE CASCADE
>) ;
>
>OwVBSQ may reference another record in the same table but must not. I gave
>OwVBSQ a NOT NULL constraint so it could take NULL values for those records
>where this self referencing does not apply. But as soon as I enter a record
>where OwVBSQ is NULL I get an error message. What is wrong ?
Unfortunately, you cannot remove a NOT NULL constraint. You have to create
a new temporary column *without* the constraint, commit, copy the data from
OwVBSQ into it, commit, drop OwVBSQ, commit, create OwVBSQ without the
constraint, commit, copy the data from the temp col into OwVBSQ,
commit; then drop the temp column.
heLen