How to ASCII-fy HEX string from TEXT column?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J Smith

    How to ASCII-fy HEX string from TEXT column?

    Hi.

    I've read the manual, I swear. I just can't seem to figure out this
    (seemingly simple) problem:

    table: hex_table

    (int) (text)
    +-----+----------
    | id | hex_text
    +-----+----------
    | 1 | 616263 ... (goes on for another ~2000 characters)
    +-----+----------

    how do I query this table to output the hex_text column as ascii?
    (i.e. select .... from hex_table; returns 'abc')

    if I go:
    "SELECT 0x616263" mysql returns 'abc' as expected, but
    "SELECT concat('0x', hex_text) from hex_table; doesn't work.

    Please note that conversion is impossible because the string is very
    long.

    A solution (in mysql, not an outside script) to this problem would be
    MOST appreciated.

    Thanks in advance,
    -j.
Working...