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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Check Expression

Author  Topic 

cbmse
Starting Member

1 Post

Posted - 2008-03-12 : 14:48:50
I'm using SQL 2000 Enterprise Manager Diagram Check Constrains dialog ???????

How do I CHECK Expression so that cust_zip data is:
- all numbers
- 5<=length<=10


Thanks for any help...

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-03-13 : 17:26:15
quote:
Originally posted by cbmse

I'm using SQL 2000 Enterprise Manager Diagram Check Constrains dialog ???????

How do I CHECK Expression so that cust_zip data is:
- all numbers
- 5<=length<=10


Thanks for any help...



try this expression:

cust_zip not like '%[^0-9]%' and len(cust_zip) between 5 and 10

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -