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
 Check Contraint Problem

Author  Topic 

wormz666
Posting Yak Master

110 Posts

Posted - 2010-06-14 : 03:48:07
i have a column that datatype is varchar(20)

and i use the entity integrity method..

i have problem with my check constraint..

here is my ck_column

column1 like '%[A-Z]%'

my problem is the data i been inserted or updated will be 1 character, how about if i input such 20 character or below? what should be my condition on the check constraint..


hoping for your quick reply....

tnx you so much..

finding the truth
making a maze on my mind....

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-14 : 04:54:15
Have you tried this?

column1 like '[A-Z]'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2010-06-14 : 10:52:59
sorry for late response, i tried it, but it only accept 1 character value...

finding the truth
making a maze on my mind....
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-15 : 02:11:38
Do you want not to allow duplicate characters?
Can you post some sample data with expected result?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2010-06-15 : 09:14:57
i want to post data that will not accept numeric value

like will column for Names....

sorry for the late response...

all im testing is the book that i read, but only 1 example thru entity integrity..

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-15 : 09:18:57
column1 not like '%[^A-Z]%'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

wormz666
Posting Yak Master

110 Posts

Posted - 2010-06-15 : 09:26:49
what is the use of ^?

thank you so much....

i will try it now... tnx a lot..

finding the truth
making a maze on my mind....
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-15 : 09:45:38
quote:
Originally posted by wormz666

what is the use of ^?

thank you so much....

i will try it now... tnx a lot..

finding the truth
making a maze on my mind....


It means NOT

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -