title: SQL Server (2008) Pass ArrayList or String to SP for IN()
body: <p>I was wondering how I can pass either an ArrayList, List<code>&lt;int</code>> or StringBuilder comma delimited list to a stored procedure such that I find a list of IDs using IN():</p>
  
  <pre><code>@myList varchar(50)
  
  SELECT  *
  FROM    tbl
  WHERE   Id IN (@myList)
  </code></pre>
  
  <p>In C# I am currently building the list as a string which is comma delimeted; however when using nvarchar(50) for example, as the type for the param in the stored procedure - I get an error as it can't convert '1,2,3' to int which it expects between the IN().</p>
  
  <p>Any ideas? Much appreciated.
  <br />
  Pete</p>