data conversion

Data Modeling

data conversion

This field Resid_Mat is rounding to to 2 decimal places, thus having an effect on the Num_payment field calculation as per attached sql. Does anyone know how I can remedy this? Any help will be much appreciated.

An example of Resid_Mat by running the sql gives me 2.32 instead of 2.31895961670089.

--------------

SELECT
CASE REP_INT
WHEN  '3' THEN '4'
WHEN  '6' THEN '2'
WHEN  '7' THEN '52'
WHEN '12' THEN '1'
WHEN '14' THEN '26'
ELSE '12' END  AS Div
,(COALESCE(cnt_mat_dte,pricing_dte) - Per_dte)/365.25  AS Res_Mat
,CASE WHEN Res_Mat  <= 0 THEN 1 ELSE
CAST( (COALESCE(cnt_mat_dte,pricing_dte) - Per_dte)/365.25 * Div AS INT)  END AS Payments
FROM t_mor_data

1 REPLY
Enthusiast

Re: data conversion

SELECTCASE REP_INT  WHEN  '3' THEN '4'WHEN  '6' THEN '2'WHEN  '7' THEN '52'WHEN '12' THEN '1'WHEN '14' THEN '26'ELSE '12' END  AS Div ,(COALESCE(cnt_mat_dte,pricing_dte) - Per_dte)/365.25000000000000  AS Res_Mat  ,CASE WHEN Res_Mat  <= 0 THEN 1 ELSECAST( (COALESCE(cnt_mat_dte,pricing_dte) - Per_dte)/365.25 * Div AS INT)  END AS Payments FROM t_mor_data 

this code will give you decimals as needed