title: How to cast varchar into int - SQL Error: '=' cannot be applied to varchar, bigint
body: <p>I have a list of product collection ids in the form of <code>varchar</code> datatype.</p>
  
  <p>Referring to a sample structure below.. I would like to retrieve the item names of collection id (pro_col_id) 3453, 3454, 3455. </p>
  
  <p><a href="https://i.stack.imgur.com/e6ky3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/e6ky3.png" alt="enter image description here"></a></p>
  
  <p>My query is as follows:</p>
  
  <pre><code>select pro_col_id, name
  from collections_table 
  where pro_col_id in (3453, 3454, 3455);
  </code></pre>
  
  <p>When I ran this query, I got an error </p>
  
  <blockquote>
    <p>SQL Error: '=' cannot be applied to varchar, bigint</p>
  </blockquote>
  
  <p>So I tried to cast <code>pro_col_id</code> as int like this:</p>
  
  <pre><code>select pro_col_id, name
  from collections_table 
  where cast(pro_col_id as int) in (3453, 3454, 3455);
  </code></pre>
  
  <p>but I still get the same error. Does anyone know what is the issue causing this?</p>
  
  <p>Thank you!</p>