日期:2014-05-17 浏览次数:20417 次
;with cte (id,num) as
(
select 1,10.0000002
union all select 2,10.010
union all select 3,15.050
union all select 4,18.1999999
)
select ID,cast(num as numeric(10,2)) as [sum] from cte
/*
ID sum
1 10.00
2 10.01
3 15.05
4 18.20
*/
;with cte (id,num) as
(
select 1,10.0000002
union all select 2,10.010
union all select 3,15.050
union all select 4,18.1999999
)
select ID,
sum=cast(num as decimal(10,2))
from cte
/*
ID sum
1 10.0000000
2 10.0100000
3 15.0500000
4 18.1900000
*/
create table #test
(id int identity,testPrice money)
go
insert into #test
select 10.0000002
union all select 2100.090
union all select 375.050
union all select 4108.1909999
go
select id,convert(numeric(10,2),testPrice) as testPrice from #test
create table #test
(id int identity,[SUM] money)
go
insert into #test
select 10.0000002
union all select 2100.090
union all select 375.050
union all select 4108.1909999
go
select id,convert(numeric(10,2),[SUM]) as [SUM] from #test