Hi,
Thanks for the suggestion. I apologize for not including everything in my code question....here is most of what I truly have in my db function:
set @nameStr = 'aaa,bbb,ccc'
set @case_str = replace(@cases,' ','') -- get rid of spaces
set @case_str = '''' + replace(@case_str,',',''',''') +...