title: How to select rows where a combination of columns matches a list of values?
body: <p>Suppose I have a table with values like this:</p>
  
  <pre><code>CREATE TABLE foo 
  (
    ID int NOT NULL,
    Box1 varchar(50),
    Box2 varchar(50),
    Box3 varchar(50),
    CONSTRAINT PK_foo PRIMARY KEY (ID)
  );
  
  INSERT INTO foo (ID, Box1, Box2, Box3) VALUES 
    (0, 'FOOBIE BLETCH', NULL, NULL),
    (1, 'DUAM XNAHT', NULL, NULL),
    (2, 'HACKEM MUCHE', 'FNORD', NULL),
    (3, 'DAIYEN FOOELS', 'ELBIB YLOH', 'GARVEN DEH'),
    (4, 'JUYED AWK YACC', 'FNORD', NULL),
    (5, 'FOOBIE BLETCH', NULL, NULL),
    (6, 'JUYED AWK YACC', 'FOOBIE BLETCH', NULL),
    (7, 'HACKEM MUCHE', 'FNORD', 'FOOBIE BLETCH'),
    (8, 'DAIYEN FOOELS', 'GARVEN DEH', 'ELBIB YLOH')
  </code></pre>
  
  <p>How do I find values of <code>foo.ID</code> where any combination of <code>Box1</code>, <code>Box2</code>, and <code>Box3</code> contain specified values? The order of the values to be found does not matter. Rows that contain more values than the ones being looked for should appear in the results. <em>e.g.</em></p>
  
  <pre><code>DECLARE @ArgValue varchar
  
  SET @ArgValue = 'FOOBIE BLETCH' -- match 0, 5, 6, 7
  SET @ArgValue = 'GARVEN DEH, DAIYEN FOOELS, ELBIB YLOH' -- match 3, 8
  SET @ArgValue = 'FNORD, JUYED AWK YACC' -- match 4
  </code></pre>
  
  <p>Assume (if necessary) the existence of a stored proc <code>ArgVal_Split(@ArgVal varchar(max), @Delimiter char(1))</code> that can extract the substrings and return them as a single-column table.</p>
  
  <p>My real data is actually much more complicated than this (one table has 20 different columns that might match) so I'm looking for solutions that don't involve enumerating the column names. </p>