Alphanumeric string consists of alphabets and numbers for example a string 123xyz456abc is an alphanumeric string. Many a times it is required to extract only alphanumeric characters from a string excluding special characters, this blog post provides a function to parse alphanumeric characters from string in SQL Server

The above query creates an inline table valued function to extract alphanumeric characters. The logic is same as explained here. however, instead of using ISNUMERIC to check of numeric values I have used PATINDEX to identify alphanumeric character.

The function can be used as shown below.

The output from above query is shown below

Function to parse alphanumeric characters from string in SQL Server

 

Regards

Ahmad Osama

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook