Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 constraint question

Author  Topic 

mridang_agarwal
Starting Member

22 Posts

Posted - 2006-10-09 : 00:51:34
CREATE TABLE cust_sample
(
cust_id int
PRIMARY KEY,
cust_name char(50),
cust_address1 char(50),
cust_address2 char(50),
cust_address3 char(50),
cust_credit_limit money,
)

Hey guys,
I would like to place a contraint that specifies that either cust_address1, cust_address2 or cust_address3 must be filled in. How do I do this?

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-09 : 01:13:21
[code]CREATE TABLE cust_sample
(
cust_id int
PRIMARY KEY,
cust_name char(50),
cust_address1 char(50),
cust_address2 char(50),
cust_address3 char(50),
cust_credit_limit money,
check (cust_address1 is not null or cust_address2 is not null or cust_address3 is not null)
)[/code]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

benjo
Starting Member

8 Posts

Posted - 2006-10-26 : 04:11:33
harsh may be right.
Go to Top of Page
   

- Advertisement -