Обсуждение: Drop Foreign Key

Поиск
Список
Период
Сортировка

Drop Foreign Key

От
"Gregory Wood"
Дата:
I'd like to drop a foreign key constraint on a table. I know there are a
number of triggers created by a FK, but how many, how do I find them to
delete them, and what other gotchas might I find when removing the
constaint(s)?

It looks like there is an INSERT/UPDATE trigger on the main table, and two
more on the table it's keyed into (one UPDATE, one DELETE)? If this is true,
can I just delete those three triggers and be done with it?

Thanks in advance,
Greg


Re: Drop Foreign Key

От
Stephan Szabo
Дата:
On Thu, 31 Jan 2002, Gregory Wood wrote:

> I'd like to drop a foreign key constraint on a table. I know there are a
> number of triggers created by a FK, but how many, how do I find them to
> delete them, and what other gotchas might I find when removing the
> constaint(s)?
>
> It looks like there is an INSERT/UPDATE trigger on the main table, and two
> more on the table it's keyed into (one UPDATE, one DELETE)? If this is true,
> can I just delete those three triggers and be done with it?

You should probably use DROP TRIGGER on them, and you'll need to double
quote the trigger name.


Re: Drop Foreign Key

От
"Gregory Wood"
Дата:
> > I'd like to drop a foreign key constraint on a table. I know there are a
> > number of triggers created by a FK, but how many, how do I find them to
> > delete them, and what other gotchas might I find when removing the
> > constaint(s)?
> >
> > It looks like there is an INSERT/UPDATE trigger on the main table, and
two
> > more on the table it's keyed into (one UPDATE, one DELETE)? If this is
true,
> > can I just delete those three triggers and be done with it?
>
> You should probably use DROP TRIGGER on them, and you'll need to double
> quote the trigger name.

I'll be happy to do so (although right now I'm wishing I provided explicit
names... "RI_ConstraintTrigger_160453997" is a mouthfull). But am I right
that I need to drop those three and only those three? Are there any other
things I need to worry about?

Greg




Re: Drop Foreign Key

От
Stephan Szabo
Дата:
On Thu, 31 Jan 2002, Gregory Wood wrote:

> > > I'd like to drop a foreign key constraint on a table. I know there are a
> > > number of triggers created by a FK, but how many, how do I find them to
> > > delete them, and what other gotchas might I find when removing the
> > > constaint(s)?
> > >
> > > It looks like there is an INSERT/UPDATE trigger on the main table, and
> two
> > > more on the table it's keyed into (one UPDATE, one DELETE)? If this is
> true,
> > > can I just delete those three triggers and be done with it?
> >
> > You should probably use DROP TRIGGER on them, and you'll need to double
> > quote the trigger name.
>
> I'll be happy to do so (although right now I'm wishing I provided explicit
> names... "RI_ConstraintTrigger_160453997" is a mouthfull). But am I right

Actually, even if you provided names that only changes the constraint name
not the trigger name.  7.2 should let you drop them using alter table
though, so it should be happier.

> that I need to drop those three and only those three? Are there any other
> things I need to worry about?
That should be all you need to do.