title: How to parse a comma-delimited string variable in SQL
body: <p>I am working in SQL Server 2008.  I have a stored proc that takes a parameter, called @test.  This parameter is varchar(255). In this stored proc, I need to parse this string, convert each value into a string itself (there will be a variable number of values), and build a list to use in a NOT IN statement.</p>
  
  <p>For example, suppose @test = 'a, b, c, d'.  I need to send this parameter into my stored proc.  There is a SELECT query in my stored proc that uses a NOT IN statement.  For this example, I need this NOT IN statement to read NOT IN('a', 'b', 'c', 'd').</p>
  
  <p>How do I accomplish this?  Or, is this a bad practice?</p>