title: SQL CASE isNumeric with multiple values?
body: <p>I have an instance where sometimes we aren't sure to filter by the name text or the name id. I've solved this with a case statement and <code>isnumeric</code>. For example, we have both the id and name values but we're not sure which column is being asked to filter. <code>rtresource.id</code> is numeric, and in this case we have the value <code>'183'</code> to work with. If <code>rtresource.rname (varchar)</code> is trying to filter, then we have the rname for that id 'Jane Thompson'.</p>
  
  <p><strong>So the filter is either</strong> </p>
  
  <pre><code>rtresource.id=183
  </code></pre>
  
  <p><strong>Or</strong></p>
  
  <pre><code>rtresource.rname='Jane Thompson'
  </code></pre>
  
  <p><strong>Instead becomes</strong></p>
  
  <pre><code>rtresource.rname in (CASE IsNumeric(rtresource.rname) WHEN 1 then '183' else 'Jane Thompson' End) 
  </code></pre>
  
  <p>This works awesome. The issue is having more than one set of id/rname being passed. Typically, we would ask either <code>rtresource.id in (183, 23) or  rtresource.rname in ('Jane Thompson','John Doe')</code>. How can I solve this with a case statement?</p>
  
  <pre><code>rtresource.rname in (CASE IsNumeric(rtresource.rname) WHEN 1 then ('183','23') else ('Jane Thompson','John Doe') End)
  </code></pre>
  
  <p>Above complains over the commas between values. I've also tried:</p>
  
  <pre><code>rtresource.rname in (CASE IsNumeric(rtresource.rname) WHEN 1 then ('183'+','+'23') else ('Jane Thompson'+','+'John Doe') End)
  </code></pre>
  
  <p>Which doesn't work either. Ideas? Thanks for any help in advance.</p>