Solved

put 2 digits after decimal in sql

Posted on 2007-03-19
1
4,198 Views
Last Modified: 2010-05-18
Hi there,

           I am using this average function where I am getting 18.526000. How would I truncate so that the average value comes out 18.52. This means I want to have only two digits after the decimal.

SELECT Round(AVG(CONVERT(decimal, DateDiff(d, Date_To_Media, Date_Given_to_Acctg))),2) AS Average
  FROM [Discrepancy]
0
Comment
Question by:siddhuoops
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 18751536
SELECT CAST( Round(AVG(CONVERT(decimal, DateDiff(d, Date_To_Media, Date_Given_to_Acctg))),2) as NMERIC(10,2) )  AS Average
  FROM [Discrepancy]
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
if and else in stored procedure 19 42
SQL Date from a string 4 58
SQL query to summarize items per month 5 54
Help with simplifying SQL 6 51
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

20 Experts available now in Live!

Get 1:1 Help Now