Replacing parts of a string
Sometimes, you need to replace characters from a string with something else.
For example, if a name was inserted in a table with an extra character, you may want to fix the mistake.
If a company was acquired and changed its name, you need to replace the old company name with the new name in all documents stored in the database.
In this exercise, you will use a built-in function that replaces a part of a string with something else. For using the function correctly, you need to supply the following parameters:
- the expression
- the string to be found
- the replacement string.
Este ejercicio forma parte del curso
Functions for Manipulating Data in SQL Server
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
SELECT
first_name,
last_name,
email,
-- Replace "yahoo.com" with "live.com"
___ AS new_email
FROM voters;