Sql-server – SQL to update part of data field

sql server

I am looking to put an SQL update statement together to remove an ampersand sign (&) for customer names – I need to replace it with the word 'and'.

This will be for multiple customer records.

Thanks
Paula

Best Answer

Without knowing a bit more about the data structure and which server you're using it is difficult to suggest an answer. If you're using Microsoft's SQL Server, you can look at using the REPLACE function. For example

UPDATE Customers
SET CustomerName = REPLACE(CustomerName, ' & ', ' and ')

I created a quick demo for you in SQL Fiddle.