Friday, June 21, 2013

Difference between STUFF and REPLACE in SQL Server?

Posted by Rahul Kharde at 2:23 AM

REPLACE is used to replace all the occurrences of the given pattern in a string.

Example

SELECT REPLACE('Hello i am here','H','m')
-- mello i am mere



STUFF used to replace the part of string with some other string.

Example
 
SELECT STUFF('Hello i am here',1,5,'Hi')
-- Hi i am here





If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top