How to replace first and last character of column in sql server?

后端 未结 9 2749
名媛妹妹
名媛妹妹 2021-02-19 11:43

I have a database column and its give a string like ,Recovery, Pump Exchange,.

I want remove first and last comma from string.

Expected Result :

9条回答
  •  -上瘾入骨i
    2021-02-19 11:54

    Alternatively to dasblinkenlight's method you could use replace:

    DECLARE @words VARCHAR(50) = ',Recovery, Pump Exchange,'
    SELECT REPLACE(','+ @words + ',',',,','')
    

提交回复
热议问题