The first function recursively removes all characters matching a supplied patindex patten on a string by string basis.
select cusno,last_name,[dbo].[xRemoveMatchedCharacters](last_name,'%[^0-9a-z]%')
from cusmas c
select cusno,last_name,[dbo].[xRemoveMatchedCharacters](last_name,'%[0-9a-z]%')
from cusmas c
The second version is a table based function built on the first function.
select cusno,last_name,z.*
from cusmas c
cross apply [dbo].[zRemoveMatchedCharacters](last_name,'%[^0-9a-z]%')z
select cusno,last_name,z.*
from cusmas c
cross apply [dbo].[zRemoveMatchedCharacters](last_name,'%[0-9a-z]%')z