title: SQL CHAR INDEX IN WHERE CLAUSE TO SEARCH STRING
body: <p>I have a column in a table with sample data as follows:</p>
  
  <pre><code>ServiceTypeIds
   7,1
   1,9 
   1
   9
   4
   7
   7 
  </code></pre>
  
  <p>In my Where clause I use the following to search on it:</p>
  
  <pre><code>WHERE (@ServiceTypes IS NULL 
     OR CHARINDEX(','+CAST(SEP.ServiceTypeIDs as VARCHAR(255))+','
                , ','+@ServiceTypes+',') &gt; 0)))
  </code></pre>
  
  <p>If my param @ServieTypes equals '1,9', then I get results, but when it's @ServiceTypes = '1' or just '9', then I don't recieve anything back. I'm stuck and tried the above. </p>