Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011
    Posts
    1

    Unanswered: 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

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    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
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •