Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Case Statment need rounded

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-02-06 : 10:30:44
I have this case statement below it is for an access fee. My problem that I am having is that now I am getting a number that is huge. Example, 8.2350000000. I need this to be rounded up and numbers srinked to 8.24, how can I add that in my case statement below? Please help if you can.

Thanks



CASE clm_att1
WHEN 'NG' THEN CASE clm_h30 WHEN 0 THEN cast(clm_sppo as decimal(12,2))*(cast(clio_fee04 as decimal (12,2))/100)
ELSE cast(clm_H30 as decimal(12,2))*(cast(clio_fee04 as decimal (12,2))/100)
END
WHEN 'NA' THEN '0.00'

WHEN 'AF' THEN CASE clm_h30 WHEN 0 THEN cast(clm_sppo as decimal(12,2))*(cast(clio_fee04 as decimal (12,2))/100)
ELSE cast(clm_H30 as decimal(12,2))*(cast(clio_fee04 as decimal (12,2))/100)*.65
END

ELSE Null
END AS AccessFeeFinal,

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-02-06 : 10:43:13
[code]CASE
WHEN clm_att1 = 'NG' AND clm_h30 = 0 THEN CONVERT(DECIMAL(12, 2), ROUND(clm_sppo * clio_fee04 / 100.0, 2))
WHEN clm_att1 = 'NG' THEN CONVERT(DECIMAL(12, 2), ROUND(clm_H30 * clio_fee04 / 100.0, 2))
WHEN clm_att1 = 'NA' THEN '0.00'
WHEN clm_att1 = 'AF' AND clm_h30 = 0 THEN CONVERT(DECIMAL(12, 2), ROUND(clm_sppo * clio_fee04 / 100.0, 2))
WHEN clm_att1 = 'AF' THEN CONVERT(DECIMAL(12, 2), ROUND(clm_H30 * clio_fee04 / 100.0 * 0.65, 2))
ELSE NULL
END AS AccessFeeFinal,[/code]


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-02-06 : 10:51:49
Thank you so much for you help!
Go to Top of Page
   

- Advertisement -