Re: a problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bojidar Alexandrov (bojo_do_not_spam_at_kodar.net)
Date: 11/11/04


Date: Thu, 11 Nov 2004 09:19:26 +0200


"a.k.a CyberPunk" <akaCyberPunk@discussions.microsoft.com> wrote in message
news:91253825-76EA-4A91-9A6C-137F72303A28@microsoft.com...
> Aaron, I meaning no disrespect, but i still have a problem
> this works gives 34.25, 34.5
> declare @myvalue NUMERIC(6,2)
> set @myvalue = 34.443388

Here you declare precision of 6 with 2 decimal places. Then assign a number
with precision of 8 with 6 decimal places so it gets rounded here.
Try to do this and will see.

declare @myvalue NUMERIC(6,2)
set @myvalue = 34.443388
select @myvalue

So you have not mentioned what is precision of your input data, is it fixed?
With this concrete example you can use

declare @myvalue NUMERIC(18,8)
set @myvalue = 34.443388
select round(@myvalue * 4, 0, 1)/4.0

Bojidar Alexandrov