Problem Statement:
While managing a large- scale database, sometimes we might need to replace a string’s substring with another. There is always a option of deleting the record and adding it with new value. That’s the first thing that pops into everyone’s mind. But SQL provides another efficient way to do that.
Code Snippet:
Select [Name],[GroupName],REPLACE(‘sales and Marketing’, ‘Sales and’, ‘Strategic ‘) as NewValue
FROM [AdventureWorks].[HumanResources].[Department]
Where [GroupName] = ‘sales and Marketing’
Code Output: