473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Round number off and change to currency

28
Hello -

Question... What would be the best way to round a number off and change it to currency with the below statement?

SELECT Cycle AS BillCycle, SUM(PrevBillAmt) - SUM(Payment) + SUM(Adjustment) + SUM(LocServCharge) + SUM(OtherChgCred) + SUM(TotalTaxes) + SUM(TollCharge) AS Total,

**** My result is this:

2241661.6600

**** And want to change it to this:

$2241661.66

or even this will work, rounding up or down

$2241662

Thanks!
Aug 31 '07 #1
1 3265
azimmer
200 Expert 100+
Hello -

Question... What would be the best way to round a number off and change it to currency with the below statement?

SELECT Cycle AS BillCycle, SUM(PrevBillAmt) - SUM(Payment) + SUM(Adjustment) + SUM(LocServCharge) + SUM(OtherChgCred) + SUM(TotalTaxes) + SUM(TollCharge) AS Total,

**** My result is this:

2241661.6600

**** And want to change it to this:

$2241661.66

or even this will work, rounding up or down

$2241662

Thanks!
Expand|Select|Wrap|Line Numbers
  1. select '$'+cast(round(Total,0) as varchar(24))
  2.  
Note: you can put in an extra select whose FROM clause is your SELECT statement
Sep 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Matias Silva | last post by:
Can anybody tell me why I am getting rounding errors using the ROUND function. 3.7125 rounds to 3.70 when I use the following: TRUNCATE(ROUND(units_pay_amount * fees_amount, 2),2))) The correct...
14
by: Nils Grimsmo | last post by:
Why did round() change in Python 2.4? $ python2.3 Python 2.3.5 (#2, Jun 19 2005, 13:28:00) on linux2 >>> round(0.0225, 3) 0.023 >>> "%.3f" % round(0.0225, 3) '0.023' >>>
13
by: jm | last post by:
I am trying to use datepart to get the real name of the month like "April" or "APR" not just "4." I could not find it in the documentation. Sorry. Thank you.
2
by: RC | last post by:
I am getting input from a digital scale and if the weight on the scale is 9.25 pounds, the input looks like: 009.25LB I need to remove the LB and the leading zeros and have the remaining value...
5
by: Kamaluokeakua | last post by:
I have to write an application that deals with clients in multiple countries. The addresses, phone numbers, country id and currency information has to be stored into a database that allows for the...
7
by: zlf | last post by:
1ˇ˘Here is a number. double nu = 123 2ˇ˘Format it with 3ˇ˘The result is "$123" I want to ask how to deformat "$123" to 123 Thx (Currency symbol is not restricted to '$')
2
by: Senna | last post by:
Hi Have a method that rounds a currency value to the closest quarter. It works fine as long as the value is above zero, below zero it rounds to the upper integer. Any working solution is much...
3
neo008
by: neo008 | last post by:
Hi all, I am using some variables as "Double" and some text boxes set "DataFormat" property to "Number with two decimal points" for currency calculations. I perform some typical mathematical...
1
by: Brian | last post by:
Hello, I am new to Microsoft access 2007 and I have created a new database. There is a dollar about that I have to change from text to currency format. Also, there is a zip code that I have to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.