There are several options depending on your environment and data size. Here are my most common two...
The Way I Prefer...
Insert the CSV values into a table, then do all the work using SQL...
INSERT INTO myTempTable (itemValue) ......
SELECT * FROM myTempTable WHERE NOT EXISTS (SELECT * FROM dataTable WHERE NodeID = itemValue)
-- Or...
SELECT * FROM myTempTable LEFT JOIN dataTable ON NodeID = itemValue WHERE NodeID IS NULL
Another option avoids the temp table, but requires client side processing...
- Ensure the CSV is alpha-numerically ordered.
- Select all NodeIDs that ARE in the CSV, alpha-numerically ordered.
- Filter out the values found in step 2, from the original set of values.
Step 2 can simply be done as...
SELECT * FROM dataTable WHERE NodeID IN (yourCSV) ORDER BY NodeID