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 > Data Access, Manipulation & Batch Languages > ANSI SQL > comparing long varchar to char problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-18-04, 14:50
rh71 rh71 is offline
Registered User
 
Join Date: Jul 2004
Posts: 7
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
Reply With Quote
  #2 (permalink)  
Old 12-19-04, 16:35
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
I've never tried it, but could you use Cast(myLongChar AS VARCHAR(1000)) or something like that?

-PatP
Reply With Quote
  #3 (permalink)  
Old 12-19-04, 21:44
rh71 rh71 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 12-20-04, 04:14
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
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
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