日期:2014-05-18  浏览次数:20421 次

请教一个sql varchar(500)转换numeric的问题
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 时出错。
语句已终止。


------解决方案--------------------
SQL code

--> 测试数据:[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)
命令已成功完成。

我这测试没有问题