473,432 Members | 1,424 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,432 software developers and data experts.

Round to 2 decmial places

284 100+
I am using SQL Server 2000.

I had made a filed name quanity , type numeric with scale =2

Now currently its showing me data like this.

Expand|Select|Wrap|Line Numbers
  1. 10
  2. 10.3
  3. 115.98
  4. 100.1
If you notice it will remove the last number if '0'

I want to be it like


Expand|Select|Wrap|Line Numbers
  1. 10.00
  2. 10.30
  3. 115.98
  4. 100.10
There is a code i know in vb6 , that can do that
Expand|Select|Wrap|Line Numbers
  1. Format(Round(quantity.Text, 2), "##0.00")
but how can we do that in SQL Server databes.
Jun 27 '10 #1
1 1293
@muddasirmunir
If you want to see it directly in the SQL, I donot think you can do it. I would go around and created SQL View where you may use CAST(quantity as smallmoney)

Or you may try to set column tyme to smallmoney or money if you need 2 decimals only.
Jun 29 '10 #2

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

Similar topics

4
by: Jack | last post by:
I have a problem that I can't seem to solve. I have checked the round, ceil and floor functions and they don't seem to do what I want. I have an entry like this <?php $tax = .065; $ad2day =...
7
by: Joe M Blow | last post by:
Hi evreyone I just want to kno how to make my value (a float) and round it off to two decimal places Thanks alot Ty
3
by: Brent Bortnick | last post by:
Does anyone know how to find out the number of decimal places a number has. I need this info so that i can round to 3 decimal places if the number has 3 decimal places or to 2 decimal places if...
8
by: Schklerg | last post by:
I have this script performing a calculation on a page on my site: <script language="JavaScript"> function compute_weight(form) { var weight = form.wt.value; var pgs = form.pgs.value; var ppi =...
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...
2
by: Niclas | last post by:
Is there a way to format an integer (when displayed as a string) always rounded downwards. So that 9.99 would be displayed as a 9 and a 10.01 would be showed as 10 ? Niclas
36
by: Phat G5 (G3) | last post by:
Has anyone found a reliable way to force JS to round to a specific number of places? Every time I try I get different results. For example, I'd need to round 3.4589 to 2 places. What is the most...
4
by: Fuzzydave | last post by:
I have been using a round command in a few places to round a value to zero decimal places using the following format, round('+value+', 0) but this consistantly returns the rounded result of...
6
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
7
by: sukeshchand | last post by:
any body have an idea abou how to wirte a function for formating a numeric field. Ex: In my table the TotalAmout is a numeric field. if i use (Select TotalAmount from Table1) then query will return...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.