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)
 question of number

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2009-03-17 : 05:02:20
if i have SELECT 28/8 the answer is 3 but i want 4 because it 3.5

another example SELECT 28/10 the result is 2,but i want 3 becuase i get 2.8

thanks
(sorry,but i dont know how it call in english)

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2009-03-17 : 05:09:41
[code]select cast(round(28/8.0, 0) as int)[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-17 : 05:21:23
SELECT CEILING( 28 / 8.0E) -- .0E notation to avoid integer math


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-17 : 11:28:43
http://sqlblogcasts.com/blogs/madhivanan/archive/2008/01/16/beware-of-implicit-conversions.aspx
Go to Top of Page
   

- Advertisement -