Article View: bit.databases.mssql-l
Article #180Help with constraints
From: arabub
Date: Thu, 01 Nov 2001 21:15
Date: Thu, 01 Nov 2001 21:15
12 lines
1285 bytes
1285 bytes
How can I create a table so that certain constraints are already built in, and automatically enforced on every insert? Example: A table has a column "foo" and a column "bar". Either or both can be NULL. Only one of them can be not NULL. I.e. if foo is not NULL then bar must be NULL, and vice-versa. Whenever I try to insert a row with both foo and bar not NULL, then I want an error. Is there a way to write query on a table that will tell me whether such constrainst exist, and what they are? Thanks!
Technical Details
Message-ID:
<a714a1f2.0111011315.30e08b36@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6611,9cf0dd6cd3bdf8fd,start X-Google-Attributes: gidf6611,public X-Google-ArrivalTime: 2001-11-01 13:15:50 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: arabub@yahoo.com (arabub) Newsgroups: bit.databases.mssql-l Subject: Help with constraints Date: 1 Nov 2001 13:15:50 -0800 Organization: http://groups.google.com/ Lines: 12 Message-ID: <a714a1f2.0111011315.30e08b36@posting.google.com> NNTP-Posting-Host: 136.152.195.133 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1004649350 22596 127.0.0.1 (1 Nov 2001 21:15:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 1 Nov 2001 21:15:50 GMT