Stuff function is used to replace the occurrence of the String in a Expression based on the start value and length value.
Syntax :
STUFF ([CHARACTER EXPRESSION],[START],[LENGTH],[REPLACEMENT STRING]
Example :
SELECT STUFF('JK SQLBLOG',7,1,'SERVER ')
In above example replacement string 'SEVER' will be Inserted in the character expression.
It search for the character position 7 in the character expression and after that it will insert the replacement string.
Output :
JK SQLSERVER LOG
Use of Replace function
Replace Vs Stuff
No comments:
Post a Comment