Hello,
I have written a sproc that I added an isnull statement into it. I am not getting an error but when I look at the results I still get NULL in the column. This is my first time writing a sproc from scratch. Any help would be greatly appreciated.
Tom
I have written a sproc that I added an isnull statement into it. I am not getting an error but when I look at the results I still get NULL in the column. This is my first time writing a sproc from scratch. Any help would be greatly appreciated.
Tom
Code:
DECLARE @clnt int,@uci varchar(15),@pd int
SET @clnt = 69
SET @uci = 'VIT'
SET @pd = 377
SELECT
@uci as UCI
,@pd as pd
,(case when ar.transagebucket < 1 then '0_30'
when ar.transagebucket = 1 then '31_60'
when ar.transagebucket = 2 then '61_90'
when ar.transagebucket = 3 then '91_120'
when ar.transagebucket = 4 then '121_150'
when ar.transagebucket = 5 then '151_180'
else 'Over180' end) as AgeBucket
,ar.PatName as PatientName
,ar.AcctNu as AccountNumber
,ar.dos as Svc_Date
,ar.cptdisplay
,(ins.insdesc+ ' - ' +ins.insmne) as Insurance
,ar.chgamt
,(case when adj.trantype = 3 and adj.adjcat = 'WRITE_OFF' then isnull(adj.adjamt,0) END) as wo
,pmt.pmtamt
,ar.curbal
FROM rpt_dat_ARDetail ar
INNER JOIN rpt_FYinfo fy ON ar.reportmonth = fy.monasdt
AND ar.uci = fy.uci
INNER JOIN rpt_dic_Ins ins ON ar.insmne = ins.insmne AND ar.clntid = ins.clntid
INNER JOIN rpt_dat_PmtDetail pmt ON ar.clntid = pmt.clntid
AND ar.AcctNu = pmt.AcctNu AND ar.dos = pmt.dos
INNER JOIN rpt_dat_AdjustmentDetail adj ON ar.clntid = adj.clntid AND ar.aid = adj.aid
WHERE ar.clntid = @clnt AND fy.rptpd = @pd AND fy.rptpd = adj.rptpd
ORDER BY ar.transagebucket,ar.PatName,ar.chgamt,ar.curbal;