0
Difference between STUFF and REPLACE IN SQL SERVER
1 Answer
+ 2
DECLARE @String AS VARCHAR(100)
SET @String = âPawanâ
âUSE OF STUFF
SELECT STUFF ( @String , 2 , 3 , âXâ ) as âSTUFFSTRINGâ
This will replace all the characters starting from 2 to length 3 to X
Output : pXn
SET @String = âPawanâ
âUSE OF REPLACE
SELECT REPLACE ( @String , âaâ , âXâ ) as âREPLACESTRINGâ
This will replace all occurances of a with X
Output : pXwXn