Skip to content
Advertisement

Remove String and Symbols

I am trying to create a query to remove some varchar and symbols from a big string, basically a table will have a column with this format(the information comes from an API call):

so the requirement is to take the main “column names” from the sample, so at the end the string will be like:

this should be dynamic because we could have more data like $.Entities.Name, $.CountryService.Region, etc

Advertisement

Answer

This is rather simple and can be done leveraging STRING_SPLIT, STRING_AGG, and CHARINDEX.

Results:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement