probleme dropping constraint
Posted in 2000
Topics: Triggers, Constraints & Referential Integrity
Hi Informixers,
I want to start with the constraint instruction between tabels and columns.
I created a constraint with:
alter table t_lev modify(lev_nr char(10) primary key);
alter table t_dgbaah add constraint (foreign key (dah_derde) referencest_lev(lev_nr);
After this I can't remove any record anymore out of table t_lev where the
lev_nr still exists in the column dah_derde of the table t_dgbaah. So far so
good.
But, if I want to remove the constraint, I use the instruction:
alter table t_dgbaah drop constraint dah_derde;
Then the system answers: 623: Unable to find CONSTRAINT (dah_derde).
What's going wrong??
Thanks for any help.
Danny
ddk@fidelity-soft.be
The constraint will not be named dah_derde. Since you did not
explicitly name the constraint. Informix made one up for you. Look at
a dbschema for table t_dgbaah. On the alter table after the table name
in the references clause , it will say constraint
"owner".constraint_name. You need to use that constraint name to drop
it.
Danny De Koster wrote:
>
> Hi Informixers,
>
> I want to start with the constraint instruction between tabels and columns.
> I created a constraint with:
>
> alter table t_lev modify(lev_nr char(10) primary key);
> alter table t_dgbaah add constraint (foreign key (dah_derde) references> t_lev(lev_nr);
>
> After this I can't remove any record anymore out of table t_lev where the
> lev_nr still exists in the column dah_derde of the table t_dgbaah. So far so
> good.
> But, if I want to remove the constraint, I use the instruction:
>
> alter table t_dgbaah drop constraint dah_derde;>
> Then the system answers: 623: Unable to find CONSTRAINT (dah_derde).
>
> What's going wrong??
>
> Thanks for any help.
>
> Danny
> ddk@fidelity-soft.be
Danny De Koster wrote:
> I want to start with the constraint instruction between tabels and columns.
> I created a constraint with:
>
> alter table t_lev modify(lev_nr char(10) primary key);
> alter table t_dgbaah add constraint (foreign key (dah_derde) references> t_lev(lev_nr);
>
> After this I can't remove any record anymore out of table t_lev where the
> lev_nr still exists in the column dah_derde of the table t_dgbaah. So far so
> good. But, if I want to remove the constraint, I use the instruction:
>
> alter table t_dgbaah drop constraint dah_derde;>
> Then the system answers: 623: Unable to find CONSTRAINT (dah_derde).
> What's going wrong??
You didn't specify the name of the constraint, so it has a system
manufactured name, and that manufactured name is not dah_derde. You
will need to find the correct constraint name (possibly via DB-Access),
and then drop it. It the constraint name has a leading blank, then you
will need to (a) set DELIMIDENT=yes in the environment and (b) specify
the constraint name inside double-quotes in the ALTER TABLE statement.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"