create tablea(a int,e binary(50))
insert into a(a,e)
select 6,convert(binary,'汉字bbbb')
select convert(varchar,e) from a--查询分析器中运行正常的。

解决方案 »

  1.   

    create table tb1 (id int,ny binary(20))insert into tb1 (id ,ny) values (1,cast('syh' as binary))
    insert into tb1 (id ,ny) values (1,cast('孙一航' as binary))
    insert into tb1 (id ,ny) values (1,cast('孙一航syh' as binary))select id,cast(ny as varchar(20)) from tb1drop table tb1测试结果
    1 syh
    2 孙一航
    3 孙一航syh
      

  2.   

    这个binary字段本来是多个string 类型的文本,我把他用;分开,变成一个字段
    value=Encoding.ASCII.GetBytes(a.Text+";"+b.Text+";"+c.Text+";"+d.Text+";"+e.Text);
    写入数据库里的
    现在在查询分析器里面:
     select cast (regulation as varchar(8000))  from table1
    结果abc;;;??;;adf;adsf;adf  <===这里的两个??本来是两个汉字