I'm running this code on SQL2008 to remove non-aphanumerical characters from strings :
snip from my function stralpha:
...
Set @KeepValues = '%[^a-z0-9]%'
While PatIndex(@KeepValues, @Temp) > 0
Set @Temp = Stuff(@Temp, PatIndex(@KeepValues, @Temp), 1, '')
Return @Temp
...
It has worked flawlessly, but now I've got at string with the part 'AA' in it :
SELECT dbo.stralpha('10AAV2');
which returns
10AV2
and I expected
10AAV2
I've tried with other repeating characters without problems - but can reproduce with aa as well.
Does anyone have a hint troubleshoot?