title: Msg 245, Level 16, State 1, Line 5 Conversion failed when converting the varchar value '1,2' to data type int
body: <p>While passing a storelist from C# code to a SQL query, I get this error:</p>
  
  <blockquote>
    <p>Msg 245, Level 16, State 1, Line 5<br>
    Conversion failed when converting the varchar value '1,2' to data type int.</p>
  </blockquote>
  
  <p>Please help me to resolve this.</p>
  
  <pre><code>declare @STORENUM Varchar(100)
  set @STORENUM = '1,2'
  print @STORENUM
  
  SELECT DISTINCT 
      STORE_NUM, 
      ISNULL(LINE_1_ADDR, '') AS LINE_1_ADDR, 
      ISNULL(LINE_2_ADDR, '') AS LINE_2_ADDR, 
      ISNULL(LINE_3_ADDR, '') AS LINE_3_ADDR,
      CITY_NM, STATE_CD 
  FROM 
      Store 
  WHERE 
      STORE_NUM IN (CAST(@STORENUM AS INT))
  </code></pre>