title: MySQL imported wrong datatype into a VARCHAR column
body: <p>Today I did something stupid: I had a list of card numbers in an excel file that I had to import to a DB table somehow. So i exported the numbers to CSV file, but <em>without any quotes</em> (don't ask me why). The file looked like:</p>
  
  <pre><code>123456
  234567
  345678
  ...
  </code></pre>
  
  <p>Then I created a table with a single <code>VARCHAR(22)</code> column and did a </p>
  
  <pre><code>LOAD DATA LOCAL INFILE 'numbers.csv' INTO TABLE cards
  </code></pre>
  
  <p>This worked fine, apart from many warnings, which I ignored (the other stupid thing I did).
  After that I tried to query with this SQL:</p>
  
  <pre><code>SELECT * FROM cards WHERE number='123456'
  </code></pre>
  
  <p>which gave me an empty result. Whereas this works:</p>
  
  <pre><code>SELECT * FROM cards WHERE number=123456
  </code></pre>
  
  <p>Notice the missing quotes! So it seems, that I managed to populate my <code>VARCHAR</code> table with <code>INTEGER</code> data. I have no idea how that is possible at all.</p>
  
  <p>I already tried to fix this with an <code>UPDATE</code> like this</p>
  
  <pre><code>UPDATE cards SET number = CAST(number AS CHAR(22))
  </code></pre>
  
  <p>But that didn't work. </p>
  
  <p>So is there a way to fix this and how could this even happen?</p>