Solved

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

Posted on 2008-06-22
1
1,320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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