首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

2012-03-28 
请教一个sql varchar(500)转换numeric的问题RT,很不解,为什么一列为varchar(500)的字符串例如52.0050.0050

请教一个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)命令已成功完成。我这测试没有问题 

热点排行