Mohi Mohi - 1 year ago 110
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

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