用的是:select sum(cast(colA as decimal(10,2))) from table 
colA 是 nvarchar 类型

解决方案 »

  1.   

    colA  这个列中是不是有字母之类的东西啊!
      

  2.   

    可以的啊
    declare @t table(a nvarchar(20))
    insert @t select '123'
    union all select '222'select sum(cast(a as dec(8,2))) from @t
    ---------------------------------------- 
    345.00(所影响的行数为 1 行)
      

  3.   

    服务器: 消息 8114,级别 16,状态 5,行 1
    将数据类型 nvarchar 转换为 numeric 时出错。
      

  4.   

    --执行以下看看不没有非数字的数据
    select * from table
    where isnumeric(colA)=0
      

  5.   

    --执行以下看看有没有非数字的数据
    select * from table
    where isnumeric(colA)=0
      

  6.   

    检查
    select * from table where isnumeric(cola)=0 是否存在记录
      

  7.   

    decimal小数位数设置不够长
    这样应该就够了
    select sum(cast(colA as decimal(10,10))) from table
      

  8.   

    OK!非常感谢:  gc_ding(施主,给个妞泡好么)
      

  9.   

    考虑完整一点的话:select sum(case colA when isnumeric(cola) then cast(colA as decimal(10,10)) end) from table