Rounding Down in a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • narpet
    New Member
    • Oct 2006
    • 69

    Rounding Down in a query

    Okay... here's my query:

    Code:
    select tblPreGenTLL.RiskNumber, tblPreGenTLL.[Manual], cast((tblITMmaster.ITM * (tblManuals.[Base Rate] * [tblBWC-FeeCalc].[NG-Discount])) + ((tblITMmaster.ITM * (tblManuals.[Base Rate] * [tblBWC-FeeCalc].[NG-Discount])) * .1526) + ([tblBWC-FeeCalc].DWRFRate) + ([tblBWC-FeeCalc].[Add-DWRFRate]) + (tblManuals.[Base Rate] * .001)as decimal(18,4))
    from tblPreGenTLL, tblITMmaster, [tblBWC-FeeCalc], tblManuals
    where tblPreGenTLL.RiskNumber = tblITMmaster.RiskNumber
    and tblPreGenTLL.[Manual] = tblManuals.ManualID
    and [tblBWC-FeeCalc].Active = '1'
    and tblManuals.Active = '1'
    order by tblPreGenTLL.RiskNumber
    This query works exactly as I need giving me a 4-point precision decimal for the last value in the select. I need to round that value down based on the 5th decimal place. I can't find anywhere how I can round down using sql...

    If anyone can help I really appreciate it.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    As you have posted a question in the article section it is being moved to SQL Server Forum.

    MODERATOR.

    Comment

    • narpet
      New Member
      • Oct 2006
      • 69

      #3
      Oops... sorry about that

      Comment

      • teddarr
        New Member
        • Oct 2006
        • 143

        #4
        try:

        cast(expression as decimal(12,5))

        the 5 representing the number of decimal places you need,
        The 12 representing the number of decimal places I had last time I used this statement.
        Last edited by teddarr; Aug 13 '07, 06:50 PM. Reason: adding to text

        Comment

        • bwestover
          New Member
          • Jul 2007
          • 39

          #5
          Use ROUND

          Example
          Code:
          ROUND ( numeric_expression , length [ ,function ] )
          MSDN Reference

          Comment

          • narpet
            New Member
            • Oct 2006
            • 69

            #6
            Thanks for the help everyone...

            Comment

            Working...