title: CharIndex exact match?
body: <p>I have a parameter being passed into a usp that is a varchar(max). This parameters is something like the following:</p>
  
  <pre><code>'1,20,3,40,0'
  '1,5,30,0,5,9'
  '0,50,40,8,9'
  '1,10,2,3,4'
  </code></pre>
  
  <p>I need to figure out if the parameter has a value of just 0 in it anywhere. I was going to use:</p>
  
  <pre><code>CASE WHEN CHARINDEX('0',@DispIDs) &gt; 0 
       THEN convert(bit,1) 
       ELSE convert(bit,0) 
  END
  </code></pre>
  
  <p>But this still returns a true on values like 40, 30, etc. I only want to mark it as true if the param contains the 0. So the last example would return false, the others would return true.</p>