How to convert BLOB to VARCHAR in MySQL?

It is on a shared host, and I get access to Navicat. I have a field with a BLOB and I want to convert it to VARCHAR. I tried on the design screen, but everything was lost. I made a backup.

+6
source share
3 answers

try using this, i found it a while ago, you can convert it to char , not Varchar2 or Varchar , don't test it yet. Try:

 CAST(a.ar_options AS CHAR(10000) CHARACTER SET utf8) 

MySQL processes data unique. Therefore, there is a difference between Blob and Text. Text simply means a text string stored as the original, not a binary one, while a blob is a text string saved as a binary file.

+22
source

try the following query

 alter table table_name change field_name field_name VARCHAR(1000); 
+2
source

I found this on the MySQL website if you are trying to change your column to a different data type and store the new data type in the database. Works great for me!

 ALTER TABLE table_name CHANGE col col1 varchar(100) 
0
source

Source: https://habr.com/ru/post/904445/


All Articles