Assume you have vendorid and vendorname:
AB Abner
A Babner
Because you're converting to varchar, these both collapse to
ABABNER, so they look the same, while they clearly are not.
You have to convert to a fixed width, or put some delimiter in there (and be very certain that delimiter doesn't actually show up in your data).