daniel_aren
daniel_aren

Reputation: 1924

Show float result more readable in Sql Server 2008

I have this query:

select a.Nm,sum(NoInvoAb * CstPr) as 'kostnadRadLev_intäckt'
from dbo.ProdTr pt
inner join dbo.Actor a on a.CustNo = pt.CustNo
where a.CustNo > 0 and pt.TrDt like '2012%'
group by a.Nm 

First row of the result:

Cykelmagasinet AB 27865867.000000

But, I would like to change the format of the float number to something that´s easier to read like: 27 865 867.000000 or 27.865.867,00000.

Upvotes: 0

Views: 354

Answers (1)

KS Tech
KS Tech

Reputation: 194

Use:

convert(varchar,cast(sum(NoInvoAb * CstPr) as money),-1)

Eg:

declare @aa int

set @aa =123123123
Select convert(varchar,cast(@aa as money),-1) as ColumnName

Output:

123,123,123.00

Upvotes: 2

Related Questions