Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    2

    Unanswered: union varchar from diff tables returns blob

    I'm running MySQL 5.0. I'm trying a union between two selects. One select references a column defined as varchar(2048) and the other references a column from a different table, but also defined as varchar(2048). The problem is that the resultant column is returned as a blob (in the browser). If I try each select separately, they work fine, showing the strings. If I try a similar union with smaller strings (say, varchar(64)), the union works fine.

    I've looked in the manual and in the forums, but have not found anything concerning this.

    If someone can guide me in the right direction I would be most happy.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no idea what the problem could be, but you could always try CASTing back to CHAR...
    Code:
    select cast(column1 as char) as col1
      from ...
    union all  
    select cast(column2 as char)
      from ...
    or perhaps
    Code:
    select cast(column1 as char) as col1
      from (
           select column1
             from ...
           union all  
           select column2
             from ...
           ) as d
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2007
    Posts
    2
    Wow, thanks. I had no idea you could do that (I'm obviously not strong in SQL). Thank you so much.

Posting Permissions

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