Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
June 30th, 2000, 01:20 PM
 NSupremo
Junior Member

Join Date: Jun 2000
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
Im learning...

I have a column of Prices that are stored as 25.0000 (4 decimal places)

What would I add to the following line to 'fix' my decimals to 0.00 (2 places)?

Select Price from BlahTable

Thank you.

#2
June 30th, 2000, 02:55 PM
 lhallusa
Contributing User

Join Date: Jun 2000
Posts: 43
Time spent in forums: < 1 sec
Reputation Power: 14
I believe you can do this:

SELECT round(price,2) AS price FROM BlahTable WHERE etc.
Regards
lhall

[This message has been edited by lhallusa (edited June 30, 2000).]

[This message has been edited by lhallusa (edited June 30, 2000).]

#3
June 30th, 2000, 09:09 PM
 NSupremo
Junior Member

Join Date: Jun 2000
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you. That did the trick. Only one small problem so far : If there are two zeros after the decimal the last one is dropped (25.0 instead of 25.00)

I shouldnt have a problem fixing this one though.

[This message has been edited by NSupremo (edited June 30, 2000).]

#4
September 30th, 2009, 02:43 AM
 nagarajmsc
Registered User

Join Date: Sep 2009
Location: Bangalore
Posts: 1
Time spent in forums: 14 m
Reputation Power: 0
Try this one...

declare @youramountorNumber as varchar(12)
set @youramountorNumber = '1234567890'
select convert(varchar, Convert(money, @youramountorNumber), 1) as formattedAmount

Result
------
1,234,567,890.00

I hope this would help...

#5
September 30th, 2009, 03:46 AM
 SimonJM
Contributing User

Join Date: Mar 2006
Posts: 2,239
Time spent in forums: 1 Month 1 Week 2 Days 21 h 2 m 2 sec
Reputation Power: 1585
9 years later ...!
__________________
The moon on the one hand, the dawn on the other:
The moon is my sister, the dawn is my brother.
The moon on my left and the dawn on my right.
My brother, good morning: my sister, good night.
-- Hilaire Belloc

#6
September 30th, 2009, 05:07 AM
 r937
SQL Consultant

Join Date: Feb 2003
Posts: 26,806
Time spent in forums: 3 Months 1 Week 4 Days 7 h 20 m 48 sec
Reputation Power: 4208
Quote:
 Originally Posted by SimonJM 9 years later ...!

and the wrong dbms
__________________
r937.com | rudy.ca

#7
September 30th, 2009, 09:00 AM
 SimonJM
Contributing User

Join Date: Mar 2006
Posts: 2,239
Time spent in forums: 1 Month 1 Week 2 Days 21 h 2 m 2 sec
Reputation Power: 1585
Quote:
 Originally Posted by r937 and the wrong dbms

Look on the bright side, it was, at least, in English ...!

 Viewing: Dev Shed Forums > Databases > MySQL Help > SQL help to format my decimal places!