title: Execute stored procedure with array-like string separated by comma
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5426499/help-with-a-sql-search-query-using-a-comma-delimitted-parameter">Help with a sql search query using a comma delimitted parameter</a>  </p>
  </blockquote>
  
  
  
  <p>I want to write a stored procedure that performs a select on a table and need one input variable of type <code>varchar(max)</code>.  </p>
  
  <p>I'd like to send a bunch of values separated by <code>,</code> as the input parameter, e.g.</p>
  
  <pre><code>'Jack','Jane','Joe'
  </code></pre>
  
  <p>and then get the rows that contain one of these names.  </p>
  
  <p>In SQL the code would be  </p>
  
  <pre><code>Select * from Personnel where Name in ('Jack','Joe','Jane');  
  </code></pre>
  
  <p>Now I want to have a variable in my C# app, say strNames and fill it like  </p>
  
  <pre><code>string strNames = "'Jack','Joe','Jane'";
  </code></pre>
  
  <p>and send this variable to the SP and execute it. Something like  </p>
  
  <pre><code>Select * from Personnel where Name in (''Jack','Joe','Jane'') -- this is wrong
  </code></pre>
  
  <p>But <strong>how can I tell SQL Server to run such command?</strong>  </p>
  
  <p>I need to make this happen and I know it's possible, please give me the clue.</p>