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 are Row versions of DataRow?

0 Answers  


On a windows server 2003 active – passive failover cluster, how do you find the node which is active?

0 Answers  


What happens when converting big values to numeric data types?

0 Answers  


Difference between drill down and drill through report.

0 Answers  


how many types of store procedre in sqlserver 2000?

2 Answers   ATI,






two tables with table name ship(name,year) and battle (name,year),how to find the latest added year in the table ship

1 Answers  


How do I find the size of a sql server database?

0 Answers  


Explain what is lock escalation?

0 Answers  


Mention the uses of stored procedures.

0 Answers  


What do you understand by a view? What does the with check option clause for a view do?

0 Answers  


What are the differences between substr and charindex in sql server.

0 Answers  


What are the difference between “where” and “having” clause in sql server?

0 Answers  


Categories