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 Statement with date

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-07-07 : 11:13:04
Hi

I have this case statement, but I need to add in there something about the date. How do I do that? The statement that I have below works, but I just need to add in there about CLM_dout >='02-29-2008' and I am not sure how to do that. Can some one help me please?

WHEN clm_att1 = 'AF' THEN CONVERT(DECIMAL(12, 2), ROUND(clm_H30 * clio_fee04 / 100.0, 2))*.65

Thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-07 : 11:16:22
[code]
CASE WHEN clm_att1 = 'AF' AND CLM_dout >='02-29-2008'
THEN CONVERT(DECIMAL(12, 2), ROUND(clm_H30 * clio_fee04 / 100.0, 2))*.65
END
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2008-07-07 : 11:17:44
WHEN clm_att1 = 'AF' and CLM_dout >='02-29-2008'

Jim
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-07-07 : 11:28:21
Thanks for your help, but I am getting a null value and I am not sure why. See the statement below.

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' AND clm_dout>='02-29-2008' THEN CONVERT(DECIMAL(12, 2), ROUND(clm_H30 * clio_fee04 / 100.0, 2))*.65
ELSE NULL
END AS AccessFeeFinal,
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-07 : 11:38:49
it means non of the case statement condition is fulfilled or any of the columns value is null


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -