Tell us about difference between STUFF and REPLACE function in Sql Server?

 Posted by vishalneeraj-24503 on 10/7/2014 | Category: Sql Server Interview questions | Views: 420 | Points: 40
Answer:

REPLACE function is used to replace all the occurrences of the given pattern in a string.

Example:
select Replace('vishal','l','n');

Output is nishal

STUFF function is used to replace the part of string with some other string.

Syntax:
Stuff(expression,start_pos,length,replacementcharacters);


Example:
Select Stuff('vishal',1,2,'ku');

Output is kushal


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response