What's this? The last char is a space (ascii 32), but SQL says the trimmed version is exactly the same as the not trimmed one. Moreover, it turns out that the length of the keyword corresponds to the trimmed length of the keyword and that the space comes after what SQL considers to be the last character.
Note that there are only these 143 results in a table of billions (>1,000,000,000)
select k.Keyword, len(k.Keyword) LenKeyword, trim(k.Keyword) TrimKeyword,
case when k.Keyword=trim(k.Keyword) then 1 else 0 end isSame,
len(trim(k.Keyword)) LenTrimKeyword, SUBSTRING(k.Keyword,len(k.keyword)+1,1) LastCharPlus1
, ASCII (SUBSTRING(k.Keyword,len(k.keyword)+1,1)) AsciiLastCharPlus1
from #tk AdditionalSpaceAfterEndOfString
inner join SE_Keywords k
on AdditionalSpaceAfterEndOfString.Keyword=k.Keyword and AdditionalSpaceAfterEndOfString.Lang=k.Lang and AdditionalSpaceAfterEndOfString.Country=k.Country
order by k.DateAdded desc
Keyword LenKeyword TrimKeyword isSame LenTrimKeyword LastCharPlus1 AsciiLastCharPlus1
------------------------------------------------------------------------------------------------------------------------------------------------------ ----------- ------------------------------------------------------------------------------------------------------------------------------------------------------ ----------- -------------- ------------- ------------------
bio arganöl 11 bio arganöl 1 11 32
assurance retrait de permis 27 assurance retrait de permis 1 27 32
call center, centre d'appel, algerie, alger, fran?ais, francophone, ogs, ogs, ogsolution, 89 call center, centre d'appel, algerie, alger, fran?ais, francophone, ogs, ogs, ogsolution, 1 89 32
esta 4 esta 1 4 32
google périsprit 16 google périsprit 1 16 32
huizen aanbod den bosch 23 huizen aanbod den bosch 1 23 32
recruiting pflege 17 recruiting pflege 1 17 32
test by keywords 17 test by keywords 1 17 32
employer branding pflege 24 employer branding pflege 1 24 32
employer branding pflege 24 employer branding pflege 1 24 32
lepelboom 9 lepelboom 1 9 32
sun plaisance 13 sun plaisance 1 13 32
keyboost 4 10 keyboost 4 1 10 32
morocco desert tours 20 morocco desert tours 1 20 32
vraag aanbod reclame 20 vraag aanbod reclame 1 20 32
bedrijfskleding drukwerk 24 bedrijfskleding drukwerk 1 24 32
bedrijfstuitje zeilen 21 bedrijfstuitje zeilen 1 21 32
bmw occasion 12 bmw occasion 1 12 32
marketing altenheim 19 marketing altenheim 1 19 32
marketing pflegeeinrichtung 27 marketing pflegeeinrichtung 1 27 32
marketing prijsbeker 20 marketing prijsbeker 1 20 32
... 1 41 32
abonnement culture paris 24 abonnement culture paris 1 24 32
kommunikationsagentur pflege 28 kommunikationsagentur pflege 1 28 32
personalmarketing pflege 24 personalmarketing pflege 1 24 32
personalmarketing pflege 24 personalmarketing pflege 1 24 32
salon de beauté pavillons-sous-bois 35 salon de beauté pavillons-sous-bois 1 35 32
sophos safeguard 16 sophos safeguard 1 16 32
bon achat spectacles fnac 25 bon achat spectacles fnac 1 25 32
catering alphen-aan-den-rijn 28 catering alphen-aan-den-rijn 1 28 32
drone electronics 17 drone electronics 1 17 32
pflege marketing 16 pflege marketing 1 16 32
pop! vinyl 10 pop! vinyl 1 10 32
prêt sans banque 16 prêt sans banque 1 16 32
sebastien izambard 18 sebastien izambard 1 18 32
carte scenes et sorties 23 carte scenes et sorties 1 23 32
dongen nieuws delen 19 dongen nieuws delen 1 19 32
newerkkabels 12 newerkkabels 1 12 32
quad and camel in marrakech 27 quad and camel in marrakech 1 27 32
showroom marques de luxe 24 showroom marques de luxe 1 24 32
Trimming does not help, the only thing is looking if the char after the total of the string is a space:
select Keyword, Lang, Country into #tk from se_keywords where ascii (SUBSTRING(Keyword,len(keyword)+1,1)) is not null