title: Teradata SQL Table Joining with Keys with Different Formats
body: <p>I have a data format issue where I used the account-level identifier (accno) joining from two different tables, where it initially gave me Precision error in FLOAT type error. </p>
  
  <pre><code>select rcv.Product, rcv.accno, rcv.date,
              bfv.Prod_class_cd, bfv.acc_appsys_id, acc_co_no
  from FINAL_RECOVERY rcv
  inner join RTL_EXPSR_MTRL bfv
      on rcv.accno = bfv.accno and rcv.date = bfv.date
  where rcv.Product is null
  order by rcv.date;
  </code></pre>
  
  <p>So I tried to cast the accno into various other formats, but still no luck.</p>
  
  <pre><code>on cast(rcv.accno as int) = cast(bfv.accno as int) and rcv.date = bfv.date
  
  on cast(rcv.accno as decimal(12,0)) = cast(bfv.accno as decimal(12,0)) and rcv.date = bfv.date
  
  on cast(rcv.accno as char) = cast(bfv.accno as char) and rcv.date = bfv.date
  </code></pre>
  
  <p>Casting them as either int or decimals give me overflow error message, and if I cast as character I run out of spool space. Is casting the only option I have here? What would be your suggestion on how to resolve this?</p>