Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

t-sql remove all non-alphanumeric characters from a string

Create Function [dbo].[RemoveNonAlphaCharacters](@Temp VarChar(1000))
Returns VarChar(1000)
AS
Begin

    Declare @KeepValues as varchar(50)
    Set @KeepValues = '%[^a-z]%'
    While PatIndex(@KeepValues, @Temp) > 0
        Set @Temp = Stuff(@Temp, PatIndex(@KeepValues, @Temp), 1, '')

    Return @Temp
End
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #characters #string
ADD COMMENT
Topic
Name
7+5 =