How to convert from varbinary to char/varchar in mysql

Late answer…

You can use CAST or CONVERT thus

CAST(foo AS CHAR(100))
CONVERT(foo, CHAR(100))

Supported types (5.5) are:

BINARY[(N)]
CHAR[(N)]
DATE
DATETIME
DECIMAL[(M[,D])]
SIGNED [INTEGER]
TIME
UNSIGNED [INTEGER]

You can not cast to varchar directly.
There is an open MySQL bug from 2008 which no-one seems to care about and is damn annoying

Leave a Comment