title: How to pass a comma separated list to a stored procedure?
body: <p>So I have a Sybase stored proc that takes 1 parameter that's a comma separated list of strings and runs a query with in in an IN() clause:</p>
  
  <pre><code>CREATE PROCEDURE getSomething @keyList varchar(4096)
  AS
  SELECT * FROM mytbl WHERE name IN (@keyList)
  </code></pre>
  
  <p>How do I call my stored proc with more than 1 value in the list?
  So far I've tried </p>
  
  <pre><code>exec getSomething 'John'         -- works but only 1 value
  exec getSomething 'John','Tom'   -- doesn't work - expects two variables
  exec getSomething "'John','Tom'" -- doesn't work - doesn't find anything
  exec getSomething '"John","Tom"' -- doesn't work - doesn't find anything
  exec getSomething '\'John\',\'Tom\'' -- doesn't work - syntax error
  </code></pre>
  
  <p><strong>EDIT:</strong> I actually found this <a href="http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm" rel="noreferrer">page</a> that has a great reference of the various ways to pas an array to a sproc</p>