Jeff S
asked on
Fixed Length SQL Query Question
I am working on a Fixed Length Query and need help when the value is NULL. In this section of code below, the Attending Doctors Middle Initial is almost always missing; however, because it is NULL, I still need to pad a space in the column. I need to pad 1 space if null.
SELECT
OP8001_RecordType = '80'
, OP8002_Sequence = '01'
, OP8003_PatientControlNumber = UPPER(pv.TicketNumber)
, OP8097_Filler1 = SPACE(2)
, OP8004_AttendingProviderNPI = LEFT(ad.NPI , 16)
, OP8098_Filler2 = SPACE(32)
, OP8006_AttendingProviderLastName = LEFT(ad.Last , 16)
, OP8007_AttendingProviderFirstName = LEFT(ad.First , 8)
, OP8008_AttendingProviderMiddleInt = LEFT(ad.Middle , 1)
, OP8099_Filler3 = SPACE(52)
FROM #MHDO M
JOIN PatientVisit pv ON M.PatientVisitId = pv.PatientVisitId
JOIN DoctorFacility ad ON M.AttendingDoctorId = ad.DoctorFacilityId;
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.
ASKER