MSSQL 2005: Round formula to two decimal places not working

Posted on 2008-11-19
Last Modified: 2012-05-05
Hi All,

I have the following formula;

(((Variable_A*1.0) - (Variable_B*1.0)) / 1000 ) * (Variable_C*1.0)

But the results have seven number after the decimal place.

My question is how do i round this to two.

I tried ROUND((((Variable_A*1.0) - (Variable_B*1.0)) / 1000 ) * (Variable_C*1.0) ,2), but it didn't work.

Question by:detox1978
    LVL 40

    Accepted Solution

    Check this
    CONVERT(DECIMAL(10,2),(((Variable_A*1.0) - (Variable_B*1.0)) / 1000 ) * (Variable_C*1.0))

    Open in new window

    LVL 2

    Author Comment

    great thanks.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    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.
    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now