UPDATE and REPLACE part of a string

前端 未结 10 2326
渐次进展
渐次进展 2020-12-04 04:22

I\'ve got a table with two columns, ID and Value. I want to change a part of some strings in the second column.

Example of Table:



        
10条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 05:18

    You don't need wildcards in the REPLACE - it just finds the string you enter for the second argument, so the following should work:

    UPDATE dbo.xxx
    SET Value = REPLACE(Value, '123\', '')
    WHERE ID <=4
    

    (I also added the \ in the replace as I assume you don't need that either)

提交回复
热议问题