title: DB2 SQL converting CHAR to SMALLINT
body: <p>I have a <code>CHAR</code> column that I need to convert to a <code>SMALLINT</code> column. The <code>CHAR</code> column is defined as <code>CHAR(4)</code> and contains data like this <code>'360 '</code> with a space at the end. </p>
  
  <p>I tried to use the <code>CAST</code> function like this:</p>
  
  <pre><code>CAST(DCA_REVN_CD AS SMALLINT) AS REVN_CD
  </code></pre>
  
  <p>This is the error I get: </p>
  
  <blockquote>
    <p>-420 THE VALUE OF A STRING ARGUMENT WAS NOT ACCEPTABLE TO THE SMALLINT FUNCTION. </p>
  </blockquote>
  
  <p>Can anyone help? I realize it's probably because there is a space in the data. </p>