>>>>Why not doing this in FrontEnd?
>>>>I think this is better place to format strings. :-)
>>>
>>>You might be right and I am drowning on a glass of water, the reason, if you allow to call my thoughts reasonable, is that the end string has some other commas that should stay and other digits that should go without separation, for a simple example SQL will return 7201,,,1,0,1,123,456,#,,,3,# and I need 7201,,,1,0,1,1,2,3,4,5,6,#,,,3,#, so I will need to parse this (and there are more variants, only one for now but I like to keep my options open as in the future there might be another, in this case 101 indicates one type of list) in order to add only the commas needed, but then... it might be easier than what I was thinking...
>>
>>This is not very easy in T-SQL. You will need a table of numbers, operate with each value (character) separately and then finally concatenate the result back. E.g. not too complex, but definitely not using just functions.
>
>Thanks Naomi, and Boris, I forgot to thank him before
Unless, of course, you'd like to implement this as CLR function. In this case it may be a good thing.
BTW, take a look at this blog post if you're using SQL 2008 R2
http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/
If it's not broken, fix it until it is.
My Blog