Bruce Gust
asked on
What Does ISNULL Mean in this CASE Statement?
I'm trying to understand the logic behind this CASE Statement:
It seems like "description" is going to be a conjugated string that will consist of the claim id plus a keyword (Adjustment, Refund, etc) and...
What does ISNULL mean?
CASE
WHEN view_txn.type = 'C'
THEN claimid + ' Charge - ' + ISNULL(cptdesc,'')
WHEN view_txn.type = 'A'
THEN claimid + ' Adjustment - ' + ISNULL(payerdesc,'')
WHEN view_txn.type = 'P' and payer = 'I'
THEN claimid + ' Payment - ' + ISNULL(payerdesc,'')
WHEN paymentmethod = 'DS'
THEN claimid + ' Discount - ' + ISNULL(payerdesc,'')
WHEN paymentmethod = 'RV'
THEN claimid + ' Payment Reversal - ' + ISNULL(payerdesc,'')
WHEN paymentmethod = 'RF'
THEN claimid + ' Refund - ' + ISNULL(payerdesc,'')
WHEN paymentmethod = 'AJ'
THEN claimid + ' Adjustment - ' + ISNULL(payerdesc,'')
ELSE 'Payment - ' + ISNULL(payerdesc,'')
END as description,
It seems like "description" is going to be a conjugated string that will consist of the claim id plus a keyword (Adjustment, Refund, etc) and...
What does ISNULL mean?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Pawan Kumar Khowal, please read the thread prior to posting.
Everything you posted was already in the very first post above and expanded on in followup posts.
Everything you posted was already in the very first post above and expanded on in followup posts.
This happens if you dont refresh the page before posting. @Author - Ignore my comment.
@Pawan - Looking at the timestamps it appears you had the question open for almost 40 minutes before posting your comment, which seems unlikely.
@Jim (sometimes I leave the question open while I work on an answer. I try and refresh periodically so I don't waste my time, but I've accidentally done the same)
Dustin - That's also why I type real fast on easy questions, as in this case in the time it took me to come up with my witty Ted Nugent and Purple Dinosaur analogies two experts posted correct answers.
ASKER
Thank you!
I see that! You could probably speed that up with a pop culture reference generating SP in your test database.
ISNULL(cptdesc,'') -- now if the value of cptdesc is NULL then ''.
Now why they are doing is because they have to concat.
NULL + 'a' Gives NULL thats why. [SQL Server Internally works like this.]
Hope it helps.