Skip to content

Instantly share code, notes, and snippets.

@jingyang-li
Created July 17, 2020 03:52
Show Gist options
  • Save jingyang-li/a9727b2a729d7fb4a8ab063dfe6992a7 to your computer and use it in GitHub Desktop.
Save jingyang-li/a9727b2a729d7fb4a8ab063dfe6992a7 to your computer and use it in GitHub Desktop.
Remove Items with JSON (T-SQL)
declare @s varchar(max) = 'Hi my name is M and I have two sister 111) M and 2111) K'---, 3333) W';
select string_agg([value],' ') newString
from openjson('["'+replace(@s ,' ', '","') + '"]')
where [Value] not like '%[0-9])%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment