Subject | Re: From Restriced to CASCADE on delete |
---|---|
Author | javaguru_uk |
Post date | 2008-01-16T02:34:24Z |
--- In firebird-support@yahoogroups.com, "federonline"
<federonline@...> wrote:
ALTER TABLE DATA ADD CONSTRAINT FK_DATA_SENSOR_MAC
FOREIGN KEY (MAC) REFERENCES SENSOR(MAC)
ON UPDATE NO ACTION ON DELETE CASCADE;
I have replaced the RESTRICT keyword with NO ACTION because the
RESTRICT keyword is something new to FB2.0+, I think. Not quite sure
cause I have never used that keyword.
All the best,
Fidel.
<federonline@...> wrote:
> The metadata looks like this:This should do the trick:
> CREATE TABLE DATA (
> MAC VARCHAR(32) NOT NULL,
> DATETIME_STAMP TIMESTAMP default NULL);
>
> /* Foreign key(s) */
>
> ALTER TABLE DATA ADD CONSTRAINT FK_DATA_SENSOR_MAC
> FOREIGN KEY (MAC) REFERENCES SENSOR(MAC)
> ON UPDATE RESTRICT ON DELETE RESTRICT;
>
> Is there an easy ALTER I can do to the FK to cascade my deletes??
ALTER TABLE DATA ADD CONSTRAINT FK_DATA_SENSOR_MAC
FOREIGN KEY (MAC) REFERENCES SENSOR(MAC)
ON UPDATE NO ACTION ON DELETE CASCADE;
I have replaced the RESTRICT keyword with NO ACTION because the
RESTRICT keyword is something new to FB2.0+, I think. Not quite sure
cause I have never used that keyword.
All the best,
Fidel.