UPDATE and REPLACE part of a string

前端 未结 10 2320
渐次进展
渐次进展 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:14

    To make the query run faster in big tables where not every line needs to be updated, you can also choose to only update rows that will be modified:

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

提交回复
热议问题