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

How to write a query with an inner join in ms sql server?

0 Answers  


Do you know what is a trace frag? Where do we use it?

0 Answers  


can an order by clause be used in a creation of a view?

0 Answers  


Why truncate is ddl?

0 Answers  


What are the steps to process a single select statement?

0 Answers  






What is repeatable read?

0 Answers  


i need some interview questions on sql server developer plz any onee send some links.

2 Answers  


How to Handle the exceptions in Sqlsrver 2005??

3 Answers   Value Labs, Wipro,


How do I find information about the install locations for the various instances running on a computer?

0 Answers  


How to encrypt data between dialogs?

0 Answers  


What is table valued function and scalar valued functions?

0 Answers  


How to create a simple user defined function in ms sql server?

0 Answers  


Categories