-- '%[^a-z]%'
CREATE Function [dbo].[RemoveNonAlphaCharacters](@Temp VarChar(1000)) Returns VarChar(1000) AS Begin While PatIndex('%[^a-z]%', @Temp) > 0 Set @Temp = Stuff(@Temp, PatIndex('%[^a-z]%', @Temp), 1, '') Return @TEmp End
-- '%[^a-z0-9]%'
CREATE Function [dbo].[RemoveNonAlphaNumericCharacters](@Temp VarChar(1000)) Returns VarChar(1000) AS Begin While PatIndex('%[^a-z0-9]%', @Temp) > 0 Set @Temp = Stuff(@Temp, PatIndex('%[^a-z0-9]%', @Temp), 1, '') Return @Temp End
-- '%[^0-9]%'
CREATE Function [dbo].[RemoveNonNumericCharacters](@Temp VarChar(1000)) Returns VarChar(1000) AS Begin While PatIndex('%[^0-9]%', @Temp) > 0 Set @Temp = Stuff(@Temp, PatIndex('%[^0-9]%', @Temp), 1, '') Return @TEmp End
|