I have a string in my stored proc like ',,,sam,,bob,' or ',,,'
from the above string I have to delete multiple commas from it, it must look like
'sam,bob,' or only if ',,,' then '' .
I must use only Sql Server Functions.
Im using Sql Server 2008 and .Net 3.5
Thanks in advance.
This works for strings that are exclusively commas or have up to 398 contiguous commas.
Add extra powers of 2 at the top if you need more or remove from the top if you need less. The comments by each stage indicate the smallest number that this stage will not deal with successfully.
All the comment lines are in this format
So to extend the series upwards with another
REPLICATE(',',32),',')stageSo that would deal with sections of commas up to 11,806 characters.