title: SQL: Return "true" if list of records exists?
body: <p>An alternative title might be:
  Check for existence of multiple rows?</p>
  
  <p>Using a combination of SQL and C# I want a method to return true if all products in a list exist in a table.  If it can be done all in SQL that would be preferable.  I have written a method that returns whether a single <code>productID</code> exists using the following SQL:</p>
  
  <pre><code>SELECT productID FROM Products WHERE ProductID = @productID
  </code></pre>
  
  <p>If this returns a row, then the c# method returns true, false otherwise.</p>
  
  <p>Now I'm wondering if I have a list of product IDs (not a huge list mind you, normally under 20).  How can I write a query that will return a row if all the product id's exist and no row if one or more product id's does not exist?</p>
  
  <pre><code>(Maybe something involving "IN" like:
  SELECT * FROM Products WHERE ProductID IN ('1', '10', '100', 'ABC'))
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>How the result is expressed is not important to me.  Whether the query returns a <code>1</code> or <code>0</code>, an empty resultset or a non-empty one, true or false doesn't matter.  I'd prefer the answer that is 1) easy to read and understand and 2) performant</p>
  
  <p>I was envisioning concatenating the list of product id's with the SQL.  Obviously this opens the code up to SQL injection (the product id's are actually <code>varchar</code>.  in this case the chance is slim but still want to avoid that possibility).  So if there is a way around this that would be better.  Using SQL Server 2005.</p>
  
  <p>Product ID's are <code>varchar</code></p>