Hello everyone, I am using a source query as below SELECT BUSINESS_UNIT AS DEGREE_UNIT,BU_DESCR AS DESCR FROM BUSINESS_UNIT_DIM WHERE or BUSINESS_UNIT != '' or BUSINESS_UNIT != ' ' GROUP BY BUSINESS_UNIT, BU_DESCR In the BUSINESS_UNIT_DIM table there is a row with BU_DESCR = 'Unassigned'and BUSINESS_UNIT = ' ' We want to discard this record in the target. Somehow Snaplogic is still picking this particular record up using this source query and failing at the target. How do I handle this situation. Any suggestions are welcome!
Hi Ankita,
First thing I am noticing is the query you are using :
WHERE BUSINESS_UNIT != '' OR BUSINESS_UNIT != ' ' If your row has the following value BUSINESS_UNIT = ' ' The result would be :
BUSINESS_UNIT != '' → TRUE
BUSINESS_UNIT != ' ' → FALSE
TRUE OR FALSE → TRUE
Even for an empty string:
BUSINESS_UNIT != '' → FALSE
BUSINESS_UNIT != ' ' → TRUE
FALSE OR TRUE → TRUE
That's why the unwanted record gets through. My suggestion is tomake the condition even more explicit: WHERE TRIM(BUSINESS_UNIT) <> '' AND BU_DESCR <> 'Unassigned' depending on your database (NULL could be different from an empty string or a space.) WHERE BUSINESS_UNIT IS NOT NULL AND TRIM(BUSINESS_UNIT) <> '' => This is a SQL problem not a Snaplogic issue based on the information you shared.
I tried the same pipeline, with modified source query :
SELECT BUSINESS_UNIT AS DEGREE_UNIT,BU_DESCR AS DESCR FROM BUSINESS_UNIT_DIM WHERE TRIM(BUSINESS_UNIT) <> ''
AND BU_DESCR <> 'Unassigned' GROUP BY BUSINESS_UNIT, BU_DESCRIt still failed at target.
To add to this, When I run the source query in SQL Server DB, which is what we use, the query doesnt pull the null record. It happens only when the source query runs from snaplogic
Hi Ankita P., thanks for the additional information. Since the query behaves as expected when run directly in SQL Server but appears to behave differently when executed through the SnapLogic pipeline, I've submitted this to our Support team for further investigation and copied you. They'll work with you to understand what's happening and identify the appropriate next steps. Thanks!
