Blanks are hectic when it comes to joins, you will see absolutely no different between two values but they won't map with each other. This is a common scenario when you have data loaded from flat files and specially Excel.
My below replace statement will work fine and remove all sort of blanks and leave you with pure value for a hassle free join.
LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE([Value to be cleaned] , CHAR(10), ''), CHAR(13), ''), CHAR(9), ''), CHAR(160), '')))
My below replace statement will work fine and remove all sort of blanks and leave you with pure value for a hassle free join.
LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(REPLACE([Value to be cleaned] , CHAR(10), ''), CHAR(13), ''), CHAR(9), ''), CHAR(160), '')))
What an interesting post, saved me many times.
ReplyDelete