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

如何将字符串转换成numeric
例如:如何将'2343.13'转换成2343.13

------解决方案--------------------
cast(col as numeric(12,2))

or

convert
------解决方案--------------------
SQL code
select convert(numeric(10,2),'2343.13')

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

select cast('2343.13' as numeric(8,2)) n1,convert(numeric(8,2),'2343.13') n2

n1                                      n2
--------------------------------------- ---------------------------------------
2343.13                                 2343.13

(1 row(s) affected)