Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 round to the nearest thousand

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2007-04-24 : 17:26:07

Hi,

Just wondering if theres an option in SQL I don't know about.

I am doing a select statment that just grabs a single column/row.

For instance an integer such as "123457"

I want to round to the nearest thousand and bring back a result such as "123000". Is there an easy built in way to do this in SQL server or should I just do this rounding in my web app?

Thanks !
mike123

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-04-24 : 17:31:04
You can do it in the web app, or you can check out the ROUND function in BOL.

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-24 : 18:57:20
[code]
select round(123457, -3)
[/code]


KH

Go to Top of Page

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2007-04-25 : 00:05:26
perfect , thX !:)
Go to Top of Page
   

- Advertisement -