Hi,
I have a question for you. I need to round a number. I did this function... It works wells, but sometimes it gave me an error
DECLARE @Amount float(53)
--SET @Amount = 9249599.0 --'Problem.. why??
SET @Amount = 54249 -- Same thing
--SET @Amount = 892499.0 -- Again
--SET @Amount = 8892499.0 -- ok
DECLARE @Result float(53)
IF @Amount >= 10000000.0
SET @Result = ROUND(@Amount, -6)
ELSE
IF @Amount >= 1000000.0
SET @Result = ROUND(@Amount, -5)
ELSE
IF @Amount >= 100000.0
SET @Result = ROUND(@Amount, -3)
ELSE
IF @Amount >= 10000.0
SET @Result = ROUND(@Amount, -2)
ELSE
SET @Result = @Amount
select @Amount as sortie union select @Result -- just to see the result
---
Could you help me?? I don't know why??
Thanks
I have a question for you. I need to round a number. I did this function... It works wells, but sometimes it gave me an error
DECLARE @Amount float(53)
--SET @Amount = 9249599.0 --'Problem.. why??
SET @Amount = 54249 -- Same thing
--SET @Amount = 892499.0 -- Again
--SET @Amount = 8892499.0 -- ok
DECLARE @Result float(53)
IF @Amount >= 10000000.0
SET @Result = ROUND(@Amount, -6)
ELSE
IF @Amount >= 1000000.0
SET @Result = ROUND(@Amount, -5)
ELSE
IF @Amount >= 100000.0
SET @Result = ROUND(@Amount, -3)
ELSE
IF @Amount >= 10000.0
SET @Result = ROUND(@Amount, -2)
ELSE
SET @Result = @Amount
select @Amount as sortie union select @Result -- just to see the result
---
Could you help me?? I don't know why??
Thanks