Monday 29 August 2016

what is Stuff in SQL Server 2008?




  It is function used to replace the string between specified place i.e. we can replace string between two specified place with other string. It’s take four parameters i.e. string_exp1,start_position, no_of_character,string_exp2.

Syntax:-

STUFF(expression1 ,start_position,no_of_character,expresion2_wtih_replace)

Here expression1 in which we have to do replacement.
Start_position is start point of replacement.
No_of_character is how many character we have to replace.
expresion2_wtih_replace is value after replace 

Example:-

Select STUFF('abcdefgh',3,5,'123')

Ouput:-

ab123h

No comments:

Post a Comment

Note: only a member of this blog may post a comment.