ožujak 2008 - Posts

Trouble with decimals

Finally I got around on writing something about decimal trouble one of my clients had.

 Heres the sample code:

declare @q decimal (38,20), @r decimal(38,20), @e decimal (38,20)

 select @q = 1.234761818, @r = 2.234523464

select @e = @q * @r

select @e

 Can you guess at the results? Feel free to run the script, you will get a result. Now, is it correct or not? If not, why not? And whats going on here anyway?

Let me give you a hint and leave with that for now, ill come back with the answer. Hint? Try putting on the first line

SET NUMERIC_ROUNDABORT ON

have fun!