Remove numeric characters from a string

This is a SQL function that will remove numeric characters from a string. 

There is a link to the SQL menu above, you might click on that and look at where this is stored on the menu, so that you can find it when needed. 

Lots of cool stuff there...

Function to remove numeric characters from a string

create OR ALTER FUNCTION ddf_ClearNumericCharacters(@string nvarchar(max))
-- select dbo.ddf_ClearNumericCharacters('1a3d')
 
returns nvarchar(max)
as
begin
 while patindex('%[0-9]%', @string) > 0
  set @string = stuff(@string, patindex('%[0-9]%', @string), 1, '')
 return @string
end

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences