Stuff and Replace

Define Stuff Function and Replace Function.

Stuff Function
It replaces existing character.

Syntax
STUFF(string_expression, start, length, replacement_characters)

Replace Function
It replaces existing character of all occurrences.

REPLACE(string_expression, search_string, replacement_string)

Define Stuff Function and Replace Function.

Both STUFF and REPLACE are used to replace characters in a string.
select replace('abcdef','ab','xx') results in xxcdef

select replace('defdefdef','def','abc') results in abcabcabc

We cannot replace a specific occurrence of “def” using REPLACE.

select stuff('defdefdef',4, 3,'abc') results in defabcdef, where 4 is the character to begin replace from and 3 is the number of characters to replace.
Execution Plan and SQL Profiler
Execution Plan and SQL Profiler - Describe in brief SQL Server monitoring ways. We have answered this question in this section
Transaction Isolation Levels
SQL Server Transaction Isolation Levels - Define transaction and transaction isolation levels.....
SQL Server Optimization Tips, optimal performance
SQL Server Optimization Tips - In this section, we have provided all possible tips to optimize SQL Server performance......
Post your comment