top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the STUFF Function and How it differ from the REPLACE Function?

+2 votes
325 views
posted Sep 10, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

STUFF function is used to insert a string into another string by deleting some characters specified whereas REPLACE instead of replacing specific characters, replaces existing characters of all occurrences.

Stuff function Syntax:

STUFF (character_expression , start , length , replace_expression )

Example

Select Stuff ('QueryHome', 3, 3, 'abc')
This query will return the string "QuabcHome".

Replace Function Syntax:

REPLACE ( string_expression , string_pattern , string_replacement )

Example:

Select Replace ('abcabcabc', 'bc', 'xy')
This query will return the string axyaxyaxy.
answer Sep 10, 2014 by Salil Agrawal
...