Click here to Skip to main content
15,889,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all visitors
how can i format the value(194540320) to like this (194,540,320)?
i used like this( select convert(varchar(29), convert(money, Amount), 1)as Amount)
to get data from field.but the amount show with 2 decimal places(194,540,320.00).
How can i format the Amount field with no decimal places?

Best Regards,
Posted

1 solution

You can use the LEFT method to trim the decimal places, like this

SQL
declare @tempStr as varchar(29) 
set @tempStr = convert(varchar(29), convert(money, Amount), 1)
select left(@tempStr, len(@tempStr) - 3) as Amount
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900