Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Round Expand / Collapse
Author
Message
Posted Sunday, February 1, 2009 7:01 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, March 27, 2013 7:21 AM
Points: 13, Visits: 129
Hi there,
I would like to round the following number: 12,999 to 13,000 and I cant find a way, all the round options are decimal rounds.
anyone has an idea?

thanks!
Post #647694
Posted Sunday, February 1, 2009 7:52 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 22, 2014 6:56 AM
Points: 1,330, Visits: 1,434
Hello,

The following script will Round 12999 to 13000:-

Select Round(12999, -1)

This works for the example that you provided, but what is the underlying rounding algorithm that you need?

Regards,

John Marsh


www.sql.lu
SQL Server Luxembourg User Group
Post #647699
Posted Sunday, February 1, 2009 9:04 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 8:02 PM
Points: 35,397, Visits: 31,955
John is correct. To become better familiar with the ROUND function, take a look a Books Online... it has a full description and many examples to help you determine what you actually need.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #647713
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse