title: Passing a variable into an IN clause within a SQL function?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/337704/parameterizing-an-sql-in-clause">Parameterizing an SQL IN clause?</a>  </p>
  </blockquote>
  
  
  
  <p>I have a SQL function whereby I need to pass a list of IDs in, as a string, into:</p>
  
  <p>WHERE ID IN (@MyList)</p>
  
  <p>I have looked around and most of the answers are either where the SQL is built within C# and they loop through and call AddParameter, or the SQL is built dynamically.</p>
  
  <p>My SQL function is fairly large and so building the query dynamically would be rather tedious.</p>
  
  <p>Is there really no way to pass in a string of comma-separated values into the IN clause?</p>
  
  <p>My variable being passed in is representing a list of integers so it would be:</p>
  
  <p>"1,2,3,4,5,6,7" etc</p>