sql中保留小数
SELECT t1.sbvid AS DJID,
t1.ccuscode as KHDM,
t1.csbvcode AS XSDH,
t3.cinvcode AS SPDM,
t3.cinvname AS SPMC,
t3.cinvstd AS SPXH,
t4.cComUnitName AS SPDW,
t2.iquantity AS SPSL,
SPDJ=case
when t1.ccuscode=170034 then str(cast(t2.iunitprice as varchar(20)),charindex('.',cast(t2.iunitprice as varchar(20)))+4,4)
else t2.iunitprice
end,
t2.iunitprice,round(t2.iunitprice,4),
t2.imoney AS SPJE,
t2.itaxrate/100 AS SL,
t2.itax AS SE,
SPDJHS=case
when t1.ccuscode=170034 then str(cast(t2.itaxunitprice as varchar(20)),charindex('.',cast(t2.itaxunitprice as varchar(20)))+4,4)
else
t2.itaxunitprice
end,
t2.isum AS SPJEHS,
(100000+t2.autoid) AS MXXH
FROM salebillvouch t1 LEFT JOIN salebillvouchs t2 ON t1.sbvid=t2.sbvid
LEFT JOIN inventory t3 ON t2.cinvcode=t3.cinvcode
LEFT JOIN ComputationUnit t4 ON t3.cComunitCode=t4.cComunitCode
这是我写的sql语句 但是测试的时候 总是得不到自己想要的数据
t2.itaxunitprice 得到的还是原始数字
我想让这个字段保留四位小数
注:我的这个要保留的字段类型是float型的
求赐教!!!