Solved

I need to round down to nearest decimal in MS SQL View

Posted on 2008-06-22
1
1,276 Views
Last Modified: 2008-06-22
I need a simple formula to round down numbers the the nearest 2 decimals in an MS SQL view.

What I do would look like this in Excel:
ROUNDDOWN(Sales;2)

I have tried with Round and I am able to round to 2 decimals but the problem is it rounds up rather than down.

45,145 should in my case be 41,14.
0
Comment
Question by:ecgabrielsen
1 Comment
 
LVL 19

Accepted Solution

by:
LordOfPorts earned 500 total points
ID: 21842557
Try deducting 0,001 from the value prior to using ROUND, e.g.:

SELECT ROUND(ColumnName - 0,001, 2) AS ROUNDDOWN
FROM TableName;

0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now