Solved

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

Posted on 2008-06-22
1
1,288 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to run sql statements from SQLCMD or command line 2 55
SQL Encryption question 2 50
TSQL mapping detailed records to group records 9 44
Help with simplifying SQL 6 51
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

864 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

24 Experts available now in Live!

Get 1:1 Help Now