select cast(1234.567 as numeric(18,2)),查询结果:1234.57
cast是个转换语句numeric是个类型 如果用 select round(1234.567,2),小数位不能准确保留位数,当数据时变量时,小数位也出来很多位。 Select jh,rq,cyfs,scsj,cast(bj as numeric(4,0)),yz,cast(cc as numeric(4,1)),cast(cc1 as numeric(4,1)),cast(yy as numeric(4,1)),cast(ty as numeric(4,1)),cast(rcyl1 as numeric(4,1)),cast(rcyl as numeric(4,1)),cast(hs as numeric(4,1)),cast(ym as numeric(4,0)),cast(bs as numeric(6,2)),bz,cast(jkwd as numeric(4,1)),dm,jlzh,km From openrowset('MICROSOFT.JET.OLEDB.4.0','Excel 8.0;HDR=yes;IMEX=1;DATABASE=E:\shengchan\wwwroot\data\o2101.xls',[sheet1$])
|