SQL Query

mburk1968
mburk1968 used Ask the Experts™
on
I have the following code in SQL Procedure
CONVERT(MONEY, ISNULL(CededFile.ExpPaid, 0)) AS [Expense Paid Ceded]

What I want from this field is still be converted to money however if
ClaimNo = 4-08-0011A then Expense Paid Ceded = 755.10 else Expense Paid Ceded
or
ClaimNo = 4-08-0016A then Expense Paid Ceded = 2835.36 else Expense Paid Ceded or
or
ClaimNo = 4-09-0003A then Expense Paid Ceded = 9042.10 else Expense Paid Ceded or
or
ClaimNo = 4-8-0001A then Expense Paid Ceded = 2296.60 else Expense Paid Ceded or
or
ClaimNo = 4-7-0014 then Expense Paid Ceded = 0.00 else Expense Paid Ceded
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
select CONVERT( MONEY, case
         when ClaimNo = '4-08-0011A' then 755.10
         when ClaimNo = '4-08-0016A ' then 2835.36
         when ClaimNo = '4-09-0003A' then 9042.10
         when ClaimNo = '4-8-0001A' then 2296.60
         when ClaimNo = '4-07-0014' then 0.00
         else ISNULL(CededFile.ExpPaid, 0)
         end ) AS [Expense Paid Ceded]
SELECT [Expense Paid Ceded] =CASE  ClaimNo
         when ClaimNo = '4-08-0011A' then 755.10
         when ClaimNo = '4-08-0016A ' then 2835.36
         when ClaimNo = '4-09-0003A' then 9042.10
         when ClaimNo = '4-8-0001A' then 2296.60
         when ClaimNo = '4-07-0014' then 0.00
         else
         CONVERT(MONEY, ISNULL(CededFile.ExpPaid, 0))
         END
         
         
         FROM yourtable

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial