Replace TSQL Tutorial

Replace function

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