REPLACE Function In SQL Server 2008
In this article i will explain how to use REPLACE Function in SQL.
Introduction
STUFF() function is used to replaces all occurrences of a string with new characters.
Syntax
REPLACE (InputString, StringToReplace, NewString)
|
where,
InputString- Input string specifies the string in which replacement is to be done.
StringToReplace- Specifies the sequence of characters to be replaced.
NewString- New string replaced to original string
Example
Suppose we have table named Employee as.
Replace all occurrence of "agarwal" in L_Name column with "KAPOOR".