Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Joining tables on fields with varying lengths - response (3) by pjh30

$
0
0

Thank you gentlemen.  I was able to get the following to work:
INNER JOIN TABLE B ON CAST((SUBSTR('00000000000000000000',1,20-CHARS(TRIM(A.ACCT_NB)))||A.ACCT_NB) AS CHAR(50)) = B.ACCT_NUM
Perhaps the Trim wasn't necessary and maybe I didn't need to Cast to Char(50) for this Join?  Not sure, but using the Substring to get the leading zeros solved the problem.
Seems like the example presented above of Trim(Leading '0' from Cast(... would have been a bit easier though.  Wish I had seen this prior to coming up with the Substr method.  Will have to remember that in the future.  Thanks again!


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>