Subject | RE: [firebird-support] How to drop a contstraint where I don't know the name |
---|---|
Author | Brenden Walker |
Post date | 2005-05-19T13:54:29Z |
> -----Original Message-----<snip>
> From: firebird-support@yahoogroups.com
> > > > I need to drop a constraint from a table. I know the
> tablename and
> > > > that the constraint is a foreign key to another table.
> > > >If you mean for example primary key indexes created to support primary
> > > > ALTER TABLE CUSTOMERINFO DROP CONSTRAINT INTEG_87
> > >
> > > Without knowing the name, you cannot drop the constraint.
> > >
> > > With regards,
> >
> > Well, not quite. You can:
> >
> > delete from RDB$RELATION_CONSTRAINTS where
> RDB$RELATION_NAME = "<some
> > table name>" and RDB$CONSTRAINT_TYPE = "<some type>"
> >
> > Of course this requires deletion of all constraints of a particular
> > type, but for this persons question it might be possible to use the
> > RDB$INDEX_NAME (pull the primary index from the foreign table
> > perhaps?)
>
> I haven't investigated this, but will this also delete auto
> automatically created index, for example?
key constraints? Then the answer is yes. Not sure about foreign keys,
I've only ever used this technique to manage primary keys and their
constraints (since IB 5.6).