view raw
Mohi Mohi - 8 months ago 47
SQL Question

SQL Server : how to update with string replace

How can I update some of columns:

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

Consider data of one column is
and must be changed to


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

update product
    set title = stuff(title, 1, 2, 'za')
    where title like 'mn%';