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

Explain system scalar functions?

0 Answers  


Do you think BCNF is better than 2NF & 3NF? Why?

0 Answers   Ernst Young,


I have a table Events Events containing cardno,time,id,name- -each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible

0 Answers  


please tell me the query to get details of the employee having the second largest salary

11 Answers   247Customer,


What is scan table/view and seek table/view when its occurs? : sql server database administration

0 Answers  






What are user-defined functions (udfs) in sql server?

0 Answers  


Differentiate between mongodb vs. Sql server?

0 Answers  


How to get a list of columns in a view using the "sp_columns" stored procedure?

0 Answers  


Is oracle faster than sql server?

0 Answers  


What are the different editions available in sql server 2000?

0 Answers  


How to change the system date and time from SQL Plus Terminal ?

0 Answers   MCN Solutions,


what is hash table

3 Answers   ILFS, Teledata,


Categories