T-SQL CASE UPDATE Statement
Posted on 2013-05-30
Below is a script that I'm trying to run that is saying "If the pay code is a salary pay code for employee ELLI0001, then set the field UPR00100.Primary_Pay_Record = 1 else 0".
But, SQL tells me that there are syntax errors. Can someone please tell me what I'm doing wrong? It would be much appreciated!
SELECT CASE WHEN UPR00400.PAYRCORD = 'SALY' AND UPR00400.EMPLOYID = 'ELLI0001'
THEN UPDATE UPR00100 SET Primary_Pay_Record = '1'
Else WHEN UPR00400.PAYRCORD <> 'SALY' AND UPR00400.EMPLOYID <> 'ELLI0001'
THEN UPDATE UPR00100.Primary_Pay_Record = '0' End
INNER JOIN UPR00100 ON UPR00400.EMPLOYID = UPR00100.EMPLOYID