Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    7

    Unanswered: comparing long varchar to char problems

    field used to be comparing varchar to char such as this and it worked ok:
    WHERE firstname = username

    now the field is comparing long varchar vs. char:
    WHERE thefullname = username

    and it's returning this error:
    Improper use of a string column, host variable, constant, or
    function "". SQLSTATE=42907

    Is there any way I can still compare these two fields ? It must be these fields so maybe a function on either of them would work ?

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I've never tried it, but could you use Cast(myLongChar AS VARCHAR(1000)) or something like that?

    -PatP

  3. #3
    Join Date
    Jul 2004
    Posts
    7
    thanks but the cast function created the following error:

    SQL0604N The length, precision, or scale attribute for column, distinct type,
    structured type, attribute of structured type, function, or type mapping "" is
    not valid. SQLSTATE=42611

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Ok, just for the jolly factor, lets assume that you are running an unpatched (or at least not current) version of DB2. As Lewis Grizzard used to say: Shoot low boys, they're riding Shetland Ponies!

    Try to use Cast(myLongChar AS VARCHAR(250)) and see if that works better.

    -PatP

Posting Permissions

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