If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Check Constraint Not Working

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-16-11, 21:54
HomeUser HomeUser is offline
Registered User
 
Join Date: Apr 2011
Posts: 1
Check Constraint Not Working

I have a table with columns which have a check constraint, Trimmed Length > 0.I tried both of these in the Create Table statement:

create table CUSTOMER (
...
CUST_FNAME varchar(30)
check (char_length(ltrim(rtrim(CUST_FNAME))) is not null),
...
)


create table CUSTOMER (
...
CUST_FNAME varchar(30)
check (char_length(ltrim(rtrim(CUST_FNAME))) > 0),
...
)


and these compile, but they don't work. I am still allowed to enter " " (a blank string) for that column, and even though the trimmed-length check constraint is supposed to prevent me from adding that row, it doesn't. I'm able to successfully enter " " in my field.

Why doesn't it work? Thanks
Reply With Quote
  #2 (permalink)  
Old 04-18-11, 03:44
aflorin27 aflorin27 is offline
Registered User
 
Join Date: Apr 2008
Location: Iasi, Romania
Posts: 317
I've tried on ASE 15.0 and rtrim(blank_string) returns NULL . So your condition is null, and Sybase documentation says that the search_condition must be not null.
__________________
Florin Aparaschivei
Iasi, Romania
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On