Subject Re: [firebird-support] Re: Alter table - how to add ON DELETE CASCADE
Author Ivan Cruz
ainpoissee wrote:

>Because I create tables using syntax like:
>
>CREATE TABLE TAB_KuuYletunnid (
> UID DOM_PK PRIMARY KEY,
> Tooleping DOM_FK REFERENCES TAB_Tooleping(UID) ON UPDATE CASCADE,
>...
>);
>
>So I don't know the name of the constraint. But I have to add ON
>DELETE CASCADE to it in update script (I'm using TUIBScript to execute
>scripts).
>
>
>
Firebird created a name for you. Try:

select RDB$CONSTRAINT_NAME from RDB$RELATION_CONSTRAINTS
where RDB$RELATION_NAME = 'TAB_KuuYletunnid'
and RDB$CONSTRAINT_TYPE = 'FOREIGN KEY'

and you will recover that name.

The next step is:

alter table TAB_KuuYletunnid drop constraint <name_returned>

Hope it helps.

Ivan.