SQL Server Rounding (CEILING) -


i've got this:

declare @billsec int set @billsec = 67  declare @_cost money set @_cost = 0.1 + (ceiling((@billsec / 60)) * 0.015)   print @_cost 

it's returning 0.12, i'm expecting 0.13 i'm trying round @billsec nearest minute.

thanks

both operands in @billsec/60 integers result truncated first (integer division).

you need make 1 or both decimal or float preserve decimal part. otherwise ceiling no-op pass exact integer.

replacing relevant part of code below solve this

ceiling(@billsec/60.0) 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -