Subject | Re: [firebird-support] How to drop a contstraint where I don't know the name |
---|---|
Author | Martijn Tonies |
Post date | 2005-05-19T07:10:16Z |
> > > I need to drop a constraint from a table. I know the tablename andI haven't investigated this, but will this also delete auto automatically
> > > that the constraint is a foreign key to another table. But as the
> > > constraint has no specific name, it can be called INTEG_xx....
> > >
> > > How can I now drop this constraint without knowing the
> > name? I need to
> > > do this by script on several databases.
> > >
> > > Thank you
> > >
> > > Herbert
> > >
> > >
> > > 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?)
created index, for example?
Etc etc...
With regards,
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com