select * from SC010200 where (SC01010+SC01011+SC01012)!=SC01053这样不行,提示:Error converting data type nvarchar to numeric.怎样转换字符类型。如何处理。。谢谢

解决方案 »

  1.   

    select * from SC010200 where (cast(SC01010 as varchar)+cast(SC01011 as varchar)+cast(SC01012 as varchar))!=SC01053
      

  2.   

    用isnumeric()函数判断哪些不能转换为数值型,如:--不能转换为数值型的记录
    select * from 表名
    where isnumeric(字段名)=0
      

  3.   

    从错误来看,以下三个字段并不都是数字
    SC01010  SC01011  SC01012
    如果你要数字加起来,那就转换成数字类型吧
      

  4.   

    select * from SC010200 
    where isnumeric(SC01010)=1
    and isnumeric(SC01011)=1
    and isnumeric(SC01012)=1
    and isnumeric(SC01053)=1
    and (SC01010+SC01011+SC01012)!=SC01053