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 2008 Forums
 Transact-SQL (2008)
 round

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2013-06-17 : 03:27:50
Hello,
There is a formula in excel as follows:
=IF(A5>0,ROUND(A5,-5)+100000,"")
I would like to do the same in sql.
For example:
The number 500000 should give 600000
The number 100000 should give the same 100000
The number 1042112 should give 1100000
The number 2301565 should give 2400000
The number 1089903 should give 1200000
The number 1362379 should give 1500000
The number 813380 should give 900000
...

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-17 : 03:36:04
NULLIF(CASE WHEN Field > 0 THEN ROUND(Field,-5) + 100000 ELSE 0 END,0)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2013-06-17 : 03:50:17
Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-17 : 03:53:43
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -