select count(*) from client where C_EMPRESA like convert( '%上海%' USING utf8 ) 没测试过 我猜的

解决方案 »

  1.   

    select count(*) from client where C_EMPRESA banary like convert( '%上海%' USING utf8 )
      

  2.   

    mysql>alter table set client='utf8_general_ci'
      

  3.   

    最好是用utf-8作为默认编码。转化方法:第一步:备份
    mysqldump --default-character-set=gb2312 -hlocalhost -uroot -B my_db --tables old_table > old.sql第二步:转换编码(类似unix/linux环境下)
    iconv -t utf-8 -f gb2312 -c old.sql > new.sql
    或者可以去掉 -f 参数,让iconv自动判断原来的字符集
    iconv -t utf-8 -c old.sql > new.sql第三步:导入修改old.sql,在插入/更新语句开始之前,增加一条sql语句: "SET NAMES utf8;",保存。
    mysql -hlocalhost -uroot my_db < new.sql