Because of billing problems the business has asked that some Location Names
be changed in the prod database. Example copied herewith below shows
three name changes. Scope of request is 2400 names.
Created a test table which is mirror of Prod called J3030_ACP_CHNG_LOC_NAME_TEST
Created a temp table which has the new names and LOCATION_IDs associated with the new names.
UPDATE J3030_ACP_CHNG_LOC_NAME_TEST TST
SET LOCATION_NAME = (SELECT LOCATION_NAME
FROM J3030_ACP_CHNG_LOC_NAME_TEMP TEMP
WHERE TEMP.LOCATION_ID = TST.LOCATION_ID);
This works and changes names supplied in ....TEMP to
the correct new names at..TEST.
But for names where the script does not find a LOCATION_ID
it change the LOCATION_NAME to null.
How to alter the script so it only changes the LOCATION_NAME
in TEST where there is LOCATION_ID in TEMP?
Allen in Dallas
Example of Name Changes
Existing LOCATION_NAME New LOCATION_NAME
Compass Grp/Bon Appetit-AU ChickFilA CMPS GRP/Bon Appetit-AU ChickFilA
Compass Grp/Canteen-Sterling Vend Spare 4 CMPS GRP/Canteen-Sterling Vend Spare 4
Compass Grp/Bon Appetit-AU Admin CMPS GRP/Bon Appetit-AU Admin