日期:2014-05-18 浏览次数:20640 次
create table tb(col varchar(10)) insert into tb select '1/3' select * from tb /* col ---------- 1/3 (1 行受影响) */ go drop table tb
------解决方案--------------------
declare @字段名 varchar(20)
set @字段名='1/3'
select cast(left(@字段名,charindex('/',@字段名)-1) as dec(18,3))/
cast(right(@字段名,len(@字段名)-charindex('/',@字段名)) as dec(18,3))
------解决方案--------------------
select cast(1.0*1/3 as dec(18,3))
------解决方案--------------------
试了下,可能有问题,似乎只能拆解。
------解决方案--------------------
字符类型 varchar(50) ,并且如果遇到不知道到类型的 都可以用这个类型