当前位置: 代码迷 >> Sql Server >> 请问一个sql varchar(500)转换numeric的有关问题
  详细解决方案

请问一个sql varchar(500)转换numeric的有关问题

热度:41   发布时间:2016-04-27 13:42:58.0
请教一个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 allselect '50.00' union allselect '50.00' union allselect '13.00' union allselect '4.75' union allselect '2.20' union allselect '80.00' union allselect '12.12'alter table test alter column [value] numeric(9,2)命令已成功完成。我这测试没有问题
  相关解决方案