Subject | Check constraint |
---|---|
Author | Nico Callewaert |
Post date | 2001-04-04T10:34:51Z |
Hi,
I have several things to check before a user is allowed to post the record.
Is it good to do all the check's in 1 single check constraint ? Or better
seperate it in single constraints ?
I defined it like this :
ALTER TABLE Dealer ADD CHECK (
EXISTS (SELECT Code FROM Deliv_Cond WHERE Deliv_Cond.Code =
Dealer.Deliv_Cond) AND
EXISTS (SELECT Code FROM Payment_Cond WHERE Payment_Cond.Code =
Dealer.Payment_Cond) AND
EXISTS (SELECT Code FROM Coin WHERE Coin.Code = Dealer.Coin) AND
EXISTS (SELECT Code FROM Country WHERE Country.Code = Dealer.Country) AND
EXISTS (SELECT Code FROM Vat_Codes WHERE Vat_Codes.Code = Dealer.Vat_Code))
What is the difference between a trigger and such a check constraint,
because when I look in IBWISQL, for every check constraint, there is a
before insert and a before update trigger defined.
Thanks,
Nico Callewaert
ncw@...
nico.callewaert@...
I have several things to check before a user is allowed to post the record.
Is it good to do all the check's in 1 single check constraint ? Or better
seperate it in single constraints ?
I defined it like this :
ALTER TABLE Dealer ADD CHECK (
EXISTS (SELECT Code FROM Deliv_Cond WHERE Deliv_Cond.Code =
Dealer.Deliv_Cond) AND
EXISTS (SELECT Code FROM Payment_Cond WHERE Payment_Cond.Code =
Dealer.Payment_Cond) AND
EXISTS (SELECT Code FROM Coin WHERE Coin.Code = Dealer.Coin) AND
EXISTS (SELECT Code FROM Country WHERE Country.Code = Dealer.Country) AND
EXISTS (SELECT Code FROM Vat_Codes WHERE Vat_Codes.Code = Dealer.Vat_Code))
What is the difference between a trigger and such a check constraint,
because when I look in IBWISQL, for every check constraint, there is a
before insert and a before update trigger defined.
Thanks,
Nico Callewaert
ncw@...
nico.callewaert@...