Mohi Mohi -4 years ago 117
SQL Question

SQl server - How Update with string replace

How can I update some of fields

UPDATE Product
SET Title = REPLACE(Title , 'mn%', 'za%')
WHERE (Title LIKE N'mn%')

Consider data of one field is 'mnfmnd' and must changing to 'zafmnd'

Answer Source

I would be inclined to use stuff() for this purpose:

update product
    set title = stuff(title, 1, 2, 'za')
    where title like 'mn%';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download