Re: implement a referential integrity constraint (long)
From: --CELKO-- <jcelko212_at_earthlink.net>
Date: Fri, 8 May 2009 05:51:42 -0700 (PDT)
Message-ID: <c4456a4e-a76b-4b43-8467-d3f115984197_at_m24g2000vbp.googlegroups.com>
Date: Fri, 8 May 2009 05:51:42 -0700 (PDT)
Message-ID: <c4456a4e-a76b-4b43-8467-d3f115984197_at_m24g2000vbp.googlegroups.com>
>> This isn't the way I would have done it, ... <<
That is being kind :)
Try the "CHECK()-from-hell approach"
As opposed to those countries that are somewhere else? :)
CONSTRAINT GenralAddressValidation
CHECK( CASE county_code
WHEN 'xx' THEN (CASE WHEN line1 NOT LIKE ..THEN 'F' WHEN line2 NOT LIKE ..THEN 'F' ..END) WHEN 'yy' THEN (CASE WHEN line1 NOT LIKE ..THEN 'F' WHEN line NOT LIKE ..THEN 'F' ..END) .. ELSE 'T' END = 'T')
This is a pain to write, but the idea is to give each contry its own second level CASE expression. Received on Fri May 08 2009 - 14:51:42 CEST