Hi,
I need to join data from 2 tables where the common field is in varying formats/lengths. In Table A, Acct_Nb is Char 20, though many of the accounts are only about 10 characters. In Table B, Acct_Num is Char 50, though the accounts are zero filled out to 20 chars each (not sure why, since the field is char 50). So I need to join on the account columns that are different lengths (50 and 20) and in which one is zero filled and the other is not. I've tried a variety of versions of CAST, but have not had any luck with it. An example would be:
INNER JOIN TABLE B ON CAST(A.ACCT_NB AS CHAR(50))=B.ACCT_NUM
Help on how to get rid of the leading zeros in the B.ACCT_NUM and then setting up the CAST would be appreciated.
Thanks
Forums: