title: How to compare string data to table data in SQL Server - I need to know if a value in a string doesn't exist in a column
body: <p>I have two tables, one an import table, the other a FK constraint on the table the import table will eventually be put into. In the import table a user can provide a list of semicolon separated values that correspond to values in the 2nd table. </p>
  
  <p>So we're looking at something like this:</p>
  
  <pre><code>TABLE 1
  ID | Column1
  1  | A; B; C; D
  
  TABLE 2
  ID  | Column2
  1   | A
  2   | B
  3   | D
  4   | E
  </code></pre>
  
  <p>The requirement is:</p>
  
  <p>Rows in TABLE 1 with a value not in TABLE 2 (C in our example) should be marked as invalid for manual cleanup by the user. Rows where all values are valid are handled by another script that already works.</p>
  
  <p>In production we'll be dealing with 6 columns that need to be checked and imports of AT LEAST 100k rows at a time. As a result I'd like to do all the work in the DB, not in another app.</p>
  
  <p>BTW, it's SQL2008.</p>
  
  <p>I'm stuck, anyone have any ideas. Thanks!</p>