29 May 2013

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

You must sign in to leave a comment.

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.32instead of 2.31895961670089.--------------