How do I convert BLOB into VARCHAR in MySQL?

后端 未结 3 699
有刺的猬
有刺的猬 2020-12-16 19:15

It is in a shared host and I access with Navicat. I have field with BLOB and I want to convert it into VARCHAR. I\'ve tried in the design screen but everything was lost. I b

相关标签:
3条回答
  • 2020-12-16 19:56

    try with the below query

    alter table table_name change field_name field_name VARCHAR(1000);
    
    0 讨论(0)
  • 2020-12-16 20:13

    try using this, I found it some time ago, you can convert it to char, not to Varchar2 or Varchar, haven't test it yet. Try:

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

    MySQL treat data unique. Hence there is a difference between Blob and Text. Text simply means a text string stored as original, not in binary, whereas a blob is a text string stored as a binary.

    0 讨论(0)
  • 2020-12-16 20:18

    I found this of MySQL's Website if you are trying to change your column to a different data type and keep the new data type in the database. Works great for what I need!

    ALTER TABLE table_name CHANGE col col1 varchar(100)
    
    0 讨论(0)
提交回复
热议问题