What is the STUFF function and how does it differ from the
REPLACE function?

Answers were Sorted based on User's Feedback



What is the STUFF function and how does it differ from the REPLACE function?..

Answer / abhaymalviya

STUFF - Delete a specified length of characters and insert
another set of characters at a specified starting point.
For example: SELECT STUFF('asdfghjkl', 3, 5, 'XYZ')
Go
here the result set is:

asXYZkl

REPLACE - Replace all occurrences of the second given string
expression in the first string expression with a third
expression.
For Example: SELECT REPLACE('Abhay', 'a', 'KKT')
Here the result set is:

KKTbhKKTy


Is This Answer Correct ?    37 Yes 1 No

What is the STUFF function and how does it differ from the REPLACE function?..

Answer / ruchi

STUFF - Delete a specified length of characters and insert
another set of characters at a specified starting point.
For example: SELECT STUFF('asdfghjkl', 3, 5, 'XYZ')
Go
here the result set is:

asXYZkl

REPLACE - Replace all occurrences of the second given string
expression in the first string expression with a third
expression.
For Example: SELECT REPLACE('Abhay', 'a', 'KKT')
Here the result set is:

KKTbhKKTy

Is This Answer Correct ?    9 Yes 6 No

Post New Answer

More SQL Server Interview Questions

What is hot add cpu in sql server 2008?

0 Answers  


What is apply operator in sql?

0 Answers  


What is row-level compre?

0 Answers  


What is meant by Active-Passive and Active-Active clustering setup?

0 Answers  


Issues related in upgrading SQL Server 2000 to 2005 / 2008

0 Answers  






What is the dbcc command and why is it used?

0 Answers  


What are the steps you will take to improve performance of a poor performing query?

1 Answers  


Can a table be created inside a trigger?

0 Answers  


How to verify the port number of the sql server?

0 Answers  


Tell me what is the significance of null value and why should we avoid permitting null values?

0 Answers  


Why do we backup Active Directory ?

0 Answers  


What are the types of resultset?

0 Answers  


Categories