SomewhereSomehow (8/17/2012)
Try using replace function like this:
declare @a varchar(100) = 'akraft,crunckel';
set @a = ''''+replace(@a,',',''',''')+''''
select @a
The above will not produce exact expected results for some of the cases:
Alexandria, VA,Arlington, TX
will be converted to
'Alexandria',' VA','Arlington',' TX'
and if I'm right the OP wouldn't want trailing spaces in ' VA' and ' TX'...
so, to make it closer to the expected one he can do:
declare @a varchar(500)
set @a = 'Alexandria, VA,Arlington, TX'
set @a = replace(''''+replace(@a,',',''',''')+'''',''','' ',''',''')
select @a