Solved

put 2 digits after decimal in sql

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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