title: Using a string of quoted values in a variable for a SQL WHERE CLAUSE
body: <p>The answer escapes me...maybe because it is not possible...</p>
  
  <p>Example that works...</p>
  
  <pre><code>SELECT * FROM TABLEA WHERE FIELD1 IN ('aaa','bbb','ccc')
  </code></pre>
  
  <p>Example that does not work...</p>
  
  <p>Attempt to leverage variable so that I can define the values once in a string of statements</p>
  
  <pre><code>DECLARE @ListValues VARCHAR(50)
  
  SET @ListValues = '''aaa'',''bbb'',''ccc'''
  
  SELECT * FROM TABLEA WHERE FIELD1 IN (@ListValues)
  </code></pre>
  
  <p>This is is obviously only a small part of the equation and for other reasons...</p>
  
  <p>I cannot leverage a table for the values and change this to a true sub-query</p>
  
  <p>The closest question I could find was this one... but does not cover my requirements obviously...
  <a href="https://stackoverflow.com/questions/7745645/storing-single-quotes-in-varchar-variable-sql-server-2008">Storing single quotes in varchar variable SQL Server 2008</a></p>
  
  <p>Thanks in advance.</p>