Below is code that I'm using to update the field UPR00100.Primary_Pay_Code. SQL keeps throwing and error saying that it cannot insert the value NULL into that field. I just want the field to be empty if it doesn't meet the criteria of the if, then statement.
No, I cannot update the field to accept NULLs, etc. I need to find a way to fix the script.
I have tried COALESCE and ISNULL on that field with no success.
UPDATE UPR00100 SET Primary_Pay_Record = CASE WHEN UPR00400.PAYRCORD = 'SALY' AND UPR00400.EMPLOYID = 'ELLI0001' THEN 1 WHEN UPR00400.PAYRCORD <> 'SALY' AND UPR00400.EMPLOYID <> 'ELLI0001' THEN 0 END FROM UPR00100 INNER JOIN UPR00400 ON UPR00100.EMPLOYID = UPR00400.EMPLOYID