T-SQL Replace

Replace function

The Replace function change a specified string value with another string value.
The Replace function is usually used when an update statement is made.

Examples

SELECT REPLACE('abcdefghijk','def','yyy');
Result: abcyyyghijk

SELECT REPLACE('abcd','abc','111');
Result: 111d

SELECT REPLACE('12345','3','c');
Result: 12c45

SELECT REPLACE(342,2,5);
Result: 345

See also: T-SQL Functions -> Substring | Patindex | Right | Rtrim | Upper