convert BLOB to text in sql
55,490
Solution 1
Try:
SELECT CONVERT(object USING utf8)
FROM tablename
Solution 2
Try this query -
SELECT CONVERT(column USING utf8) FROM myTable WHERE ID=56
Solution 3
I had the same problem - I just changed the field type in phpmyadmin! And what i see :
ALTER TABLE pages
CHANGE content
content
TEXT NULL DEFAULT NULL
('content' - my field which was in BLOB-type)
Author by
shockwave
Updated on July 05, 2022Comments
-
shockwave almost 2 years
I have a field in my database table with data type as
BLOB
.How can I view the content astext/string
using aSELECT
query inSQL
. the content'sMIMETYPE
is'text/xml charset=UTF8'
I tried with this, I'm not sure if im right with the syntax
SELECT CAST((SELECT column FROM myTable WHERE ID='56')AS CHAR(10000) CHARACTER SET utf8)
and also
SELECT CONVERT(VARCHAR(max), CAST((SELECT column FROM myTable WHERE ID='56') as binary)) from BIZDOCCONTENT
many Thanks
-
shockwave over 11 yearsI tried this but, I get an error saying right parenthesis missing. The syntax is proper. What mite be the error?
-
shockwave over 11 yearswhat do I give in place of object?
-
shockwave over 11 yearsI am not using PHP! Is there anything I can do about this in java/ sql. Please help!
-
Devart over 11 yearsYes, syntax is correct, query query should work. Try to run this command in another MySQL client, e.g. in command-line client.
-
urbanspr1nter over 11 yearsShould just be the column containing your blog. :)