We are trying to include if condition in preprocessor query as follows:
"USERS": "SELECT USERKEY FROM USERS"
"customproperty20", "STATUSKEY", "DISPLAYNAME"
"UPDATE NEWUSERDATA SET CUSTOMPROPERTY20 ='Workday'",
"UPDATE NEWUSERDATA SET STATUSKEY='1' IF(JOBCODEDESC='A') else SET STATUSKEY='0'",
"UPDATE NEWUSERDATA SET displayName = CONCAT(FirstName,' ',LastName) where (displayName is null or displayName='')"
However, after running the import job it fails and gives error as follows
|Error in Users Import - Error while processing data: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF (JOBCODEDESC='A') else SET STATUSKEY='0'' at line 1|
please suggest what shall be used for implementing condition for the preprocessor query
Solved! Go to Solution.
Its syntax error , please try below and it should work.
UPDATE NEWUSERDATA SET STATUSKEY = (case when JOBCODEDESC='A' then '1' else '0' end );