title: Storing single quotes in varchar variable SQL Server 2008
body: <p>I was wondering if there is a way to store single quote marks in SQL Server 2008.  I am building several reports up and all these reports are the exact same, except they only differ in the codes I am selecting upon.  For example, one report uses codes 'abc', 'def', 'ghi' and another report uses codes 'jkl', 'mno', 'pqr'.  I was thinking to reduce the number of Stored Procedures I will have to make, I could make a parameter on the report to choose which type of report to run.  Based off of that, I would use the correct codes.  So I was going to store these codes in a varchar variable.  Below is the functionality I was hoping for:</p>
  
  <pre><code>DECLARE @codes1 varchar, @codes2 varchar
  SET @codes1 = ''abc', 'def', 'ghi''
  SET @codes2 = ''jkl', 'mno', 'pqr''
  </code></pre>
  
  <p>Then, I was going to use the proper varchar variable based on the parameter the user chooses.  The only problem is setting the variables since the string will have single quotes in it (the string will be used in an SQL 'IN' statement, thats the reason for the single quotes being present).</p>