I have the following SQL in an SSIS Execute SQL Task.INSERT INTO TMP_AREAS (AREA_CODE, AREA_NAME) SELECT AREA_CODE, AREA_NAME FROM TMP_EXCELIMPORT WHERE (NOT EXISTS (SELECT AREA_CODE FROM TMP_AREAS AS TMP_AREAS_CHECK WHERE AREA_CODE = TMP_EXCELIMPORT.AREA_CODE) )
For info, the data in TMP_EXCELIMPORT will be along the lines of:AREA_CODE AREA_NAME10 SOUTH20 NORTH30 WEST10 NORTH10 NORTH30 WEST
I only want to add each unique entry once into my resulting table, and only then if it doesn't already exist.I thought the SQL would acheive this, but it is inserting every row, so for the above example I get North added 3 times. If I run it a second time, then it works as expected and only inserts "new" values.Any help gratefully received.