8.24.2012

Difference between STUFF and REPLACE in SQL Server

Difference between STUFF and REPLACE in SQL Server
S.No
STUFF
REPLACE
1
STUFF is used to replace the part of string with some other string.
REPLACE is used to replace all the occurances of the given pattern in a string.
2
Syntax:
STUFF (stringexpression, start, length, replacementcharacters)
Example:
SELECT STUFF('Umar's Blog is USEFUL',8,4,'DATABASE')
Output:
Umar's DATABASE is USEFUL
Syntax:
REPLACE ( string_expression , string_pattern , string_replacement )
Example:
select Replace('Umar','U','A')
Output: Amar

3 comments:

  1. "Nice and good article.. it is very useful for me to learn and understand easily.. thanks for sharing your valuable information and time.. please keep updating.php jobs in hyderabad.
    "

    ReplyDelete