Home Remove value from comma delimited string SQL Server
Reply: 0

Remove value from comma delimited string SQL Server

user723
1#
user723 Published in July 18, 2018, 10:30 pm

Suppose I have a comma delimited string (I know, it's better to normalize it, but it's not an option) and the records look like this (note the space after each comma):

11, 15, 17, 23
15, 34, 46, 69
15
27, 41, 29, 15

I need to remove '15' from all of the values that have it regardless of the position. As you can see, the number can be the only value, in the beginning, middle, at the very end of the string. After I'm done, I would like my records to look like this:

11, 17, 23
34, 46, 69

27, 41, 29

I know I can create 3-4 separate queries to handle all of the different cases, but would really like to have 1 query.

TIA, -TS.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.317029 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO