Behaviour of adding numeric values

UDA
Enthusiast

Behaviour of adding numeric values

Hi,

I have the following statement

ms_key_id = CAST(((Ms_rcm_key_id * 1000000000) + ms_handler_key_id) AS NUMERIC(18)) ;

where ms_rcm_key_id = 71700000
ms_handler_key_id = 15898.

I expect and want the reuslt to be ms_key_id = 71700000000015898, however the actual result is 71700000000015896.

Can anyone tell me why this happens and how can I get the result I expect.

Thanks,
Karen
2 REPLIES
Senior Apprentice

Re: Behaviour of adding numeric values

Hi Karen,
this is due to SQL Assistant:
set Tools - Options - Answerset - Display Full Accuracy for BigInt and Decimal (16) and Above

Dieter
Enthusiast

Re: Behaviour of adding numeric values

Hi Dieter,

That solved it.

Thanks,
Karen