• 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

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]