Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following data that I am importing and need to return a certain value in SWEEP_STATUS if the CUST_NBR matches a certain customer, but if it does not match I just want the normal results. Here is my script and it is telling me garbage after load. What am I doing wrong? nd do I have the IF THEN statement in the right place to begin with?
LOAD
COMMITMENT_ID,
SWEEP_STAT,
CUST_NBR,
FROM
[$(vFromQVD)\HRC_LIABILITIES.qvd](qvd)
IF(([CUST_NBR] = '0450011670') THEN ([SWEEP_STATUS]='Yes'));
Store HRC_LIABILITIES_ORIGINAL into [$(vToQVD)\HRC_LIABILITIES_SWEEP_STATUS_CHANGE.qvd](qvd);
it depends, you have many options
// yes for 0450011670, no for ll others
IF(CUST_NBR = '0450011670', 'Yes', 'No') as SWEEP_STAT,
// yes for .........., null for .........
IF(CUST_NBR = '0450011670', 'Yes') as SWEEP_STAT,
// yes for ......, SWEEP_STAT for other
IF(CUST_NBR = '0450011670', 'Yes', SWEEP_STAT) as SWEEP_STAT,
// 2 fields
SWEEP_STAT,
IF(CUST_NBR = '0450011670', 'Yes', 'No') as SWEEP_STAT2,
// etc....
Hi Jonathan,
Try this:
LOAD
COMMITMENT_ID,
SWEEP_STAT,
CUST_NBR,
IF(([CUST_NBR] = '0450011670') THEN ([SWEEP_STATUS]='Yes'))
FROM
[$(vFromQVD)\HRC_LIABILITIES.qvd](qvd);
LOAD
COMMITMENT_ID,
//SWEEP_STAT,
IF(CUST_NBR = '0450011670', 'Yes', 'No') as SWEEP_STAT,
CUST_NBR
FROM
[$(vFromQVD)\HRC_LIABILITIES.qvd](qvd)
Store HRC_LIABILITIES_ORIGINAL into [$(vToQVD)\HRC_LIABILITIES_SWEEP_STATUS_CHANGE.qvd](qvd);
Will this make my SWEEP_STAT populate as 'No' for everything else that is not that particular customer? Because some could be yes and others no and I want both in there, but I just want that specific customer to all be 'Yes'.
Tried this, it gave me a syntax error
it depends, you have many options
// yes for 0450011670, no for ll others
IF(CUST_NBR = '0450011670', 'Yes', 'No') as SWEEP_STAT,
// yes for .........., null for .........
IF(CUST_NBR = '0450011670', 'Yes') as SWEEP_STAT,
// yes for ......, SWEEP_STAT for other
IF(CUST_NBR = '0450011670', 'Yes', SWEEP_STAT) as SWEEP_STAT,
// 2 fields
SWEEP_STAT,
IF(CUST_NBR = '0450011670', 'Yes', 'No') as SWEEP_STAT2,
// etc....
My bad, I wasn't quite carefull:
LOAD
COMMITMENT_ID,
CUST_NBR,
IF([CUST_NBR] = '0450011670', 'Yes', SWEEP_STAT) AS SWEEP_STAT
FROM
[$(vFromQVD)\HRC_LIABILITIES.qvd](qvd);
Hopefully, this should do it.