I am using Sql Server Management Studio V17.4 to write a query. Not Oracle db.
The code I am using should take into account if there is a NULL value in the field, and return either a three digit code from one of two places, and if not then '001'.
For some reason I am still getting a NULL value in that field for one account from 2019.
Can you tell anything by just reading the SQL?
What information would you need in order to tell me where I am missing something?
,CASE WHEN ACCOUNT.ACCOUNT_TYPE_C IS NULL THEN RIGHT('000' + CAST(PAT_ACCT_CVG.ACCOUNT_TYPE_C AS VARCHAR(18)),3)
WHEN ACCOUNT.ACCOUNT_TYPE_C IS NOT NULL THEN RIGHT('000' + CAST(ACCOUNT.ACCOUNT_TYPE_C AS VARCHAR(18)),3)
ELSE '001' END