Articles → SQL SERVER → stuff and replace functions in SQL server

stuff and replace functions in SQL server














Software requirement





Prerequisite knowledge









Replace function






Picture showing how the replace function works in sql server

Click to Enlarge





SELECT 
  REPLACE(
    'This is the original string', 'is', 
    'was'
  )









Stuff function




select 
  stuff(
    'This is the original string', 6, 
    2, 'was'
  )










Picture showing how the stuff function works in SQL server

Click to Enlarge





select 
  stuff('hello', 6, 2, 'how are you')




select 
  stuff('hello ', 6, 2, 'how are you')





Posted By  -  Karan Gupta
 
Posted On  -  Sunday, January 6, 2013

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250