Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Monday, November 9, 2015 9:56 AM
Points: 1,337, Visits: 1,448
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-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:33 AM
Points: 40,381, Visits: 37,589
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."

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

Add to briefcase

Permissions Expand / Collapse