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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to handle error or exception in sql?

534


What do you understand by physical_only option in dbcc checkdb?

581


Can you index views?

509


how can you attach more than 20 ldf files in sql server

1577


explain how to create a new schema in a database? : Sql server database administration

584






What are the 3 types of schema?

604


What is a view in sql?

582


How to list all columns in a table using odbc_columns()?

538


Explain what is cte (common table expression)?

630


What is a virtual table in sql?

553


What are the types of containers in ssis?

603


What do you mean by the term 'normalization'?

674


What is pessimistic concurrency?

546


What is a DBMS, query, SQL?

577


What is sql view?

545