Solved

put 2 digits after decimal in sql

Posted on 2007-03-19
1
4,192 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

18 Experts available now in Live!

Get 1:1 Help Now