title: Redshift, casting of a decimal value is not rounding off
body: <p>I have a reshift table, which has a decimal column of <strong>(38, 29)</strong>, but the <em>original data's maximum Integer part is 6 and scale is 12</em> i.e Decimal <strong>(18,12)</strong>. But the table is created using the max precision and scale. So all the data in that has <code>0's</code> at the end of the scale part as padding.</p>
  <p>For Example:</p>
  <pre><code>12345.123456789112300000000000000000000
  </code></pre>
  <p>All the data in the table is like the above example.</p>
  <p>Now I'm retrieving the data from the table using the below query.</p>
  <pre><code>select cast(column as decimal(30,6)) from table;
  </code></pre>
  <p>The output I'm getting is</p>
  <pre><code>12345.123456
  </code></pre>
  <p>But when I try the below query</p>
  <pre><code>select cast(12345.123456789112300000000000000000000 as decimal(30,6)) from table;
  </code></pre>
  <p>The output I'm getting is</p>
  <pre><code>12345.123457
  </code></pre>
  <p>I want to know why this is happening. when I cast the column in the table, it is not rounding off to its highest value, it is just truncating.
  But when I try with the decimal itself it is truncating and it is rounding off.</p>
  <p>I also want to how to achieve the second query's result in the table itself.</p>