473,626 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Round number off and change to currency

28 New Member
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(LocServChar ge) + SUM(OtherChgCre d) + 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 3287
azimmer
200 Recognized Expert New Member
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(LocServChar ge) + SUM(OtherChgCre d) + 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
3113
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 value should be 3.71 I could round to the 3rd decimal place ROUND(X,3) and that would round it correctly to 3.71 but that would mean I would have to change the ROUND function in another
14
5930
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
3139
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
6870
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 as a number (not a text string). The best solution I came up with was to use the Left and Right functions to clean up the string so that it becomes 009.25 BUT it is still a string. I can use the CCur function to convert it to currency and it...
5
3515
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 format of any country. I would like to be able to automatically display the information in the format of their country based on the information gathered from the Country field in the database. Is there any white paper, or book or site that has...
7
4531
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
3600
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 appreciated. protected void Page_Load(object sender, EventArgs e) { double d1 = 2.73d; Response.Write(LevelCurrency(d1).ToString("c")); //Correct
3
15975
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 operations on them and in some cases I see result having more than two decimal points. How can I restrict or round-of to only two decimal places. I'm using VB6.
1
4273
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 change from text to number format. When I try to change them from text to either currency or number format I get an error stating "Some data may be lost" The setting for the FieldSize property of one or more fields have been changed to a shorter...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8368
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8512
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7203
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.