Hi I have a field which is varbinary. It has already been populated. Now how do i convert varbinary to varchar so that I can use the data in the field for some other purpose. I use a MySQL version 5.10
A:
You can use cast operation:
select cast(column_name as varchar)
from table_name
Pablo Santa Cruz
2009-12-09 10:51:31
It is throwing an error message when i use cast You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar) from table_name' at line 1
Saeros
2009-12-09 11:01:33
how are you constructing your query, can you provide a prototype of it?
Sarfraz
2009-12-09 12:27:30
I am not constructing it. It is a part of a third party app that i am using.
Saeros
2009-12-10 03:45:05
A:
The MySQL syntax that worked for me in a similar scenario to this is:
select cast(binaryColumn as CHAR) from table_name
yanigisawa
2010-03-08 08:47:08