RT,很不解,为什么一列为varchar(500)的字符串
例如
52.00 
50.00 
50.00 
13.00 
4.75 
2.20 
80.00 
12.12 
alter table table_test  alter column column_test numeric(9,2)
会这样出现错误呢? 消息 8114,级别 16,状态 5,第 1 行
从数据类型 varchar 转换为 numeric 时出错。
语句已终止。

解决方案 »

  1.   


    --> 测试数据:[test]
    if object_id('[test]') is not null drop table [test]
    create table [test]([value] varchar(500))
    insert [test]
    select '52.00' union all
    select '50.00' union all
    select '50.00' union all
    select '13.00' union all
    select '4.75' union all
    select '2.20' union all
    select '80.00' union all
    select '12.12'alter table test alter column [value] numeric(9,2)
    命令已成功完成。我这测试没有问题
      

  2.   

    .....谢谢LS,终于发现问题所在了,原来数据导入的时候有一部分是空.什么也没有,.不是0也不是null.所以转换的时候就出错了.~~