Guruji Point - Code You Want To Write

  • Home
  • Asp.Net
  • WCF
  • SQL
  • Type Script
  • AngularJS
  • Tech News
  • Blog
  • Earn Online

Wednesday, 22 February 2017

Stuff and Replace In SQL

 No comments   


Introduction

In this article i will explain about what is Stuff and Replace and what is use of both of them. Difference between stuff and replace. How to use stuff and replace in SQL.

What Stuff And Replace Is

Stuff and replace both are used for replace the existing string.In other words you can say that stuff insert a given string into another existing string and replace also did the same.
But  the only difference is stuff function insert at a specified range of a string while replace changed all the occurrence of a given string. Clearly shown in below examples: 

Stuff Syntax
STUFF ( InputString, start, length, ReplaceString)

Example

SELECT Stuff( 'romanrom', 2,  4, 'ti')

Then on result window we got 'rtirom' as a result.Stuff  starts removing  from 2nd  index and upto 4 next string including 2nd.

Replace Syntax
Replace( InputString, string_pattern, ReplaceString)

Example
SELECT replace ( 'romanrom', 'ro', 'ti')
SELECT replace ( 'KPPLKPPKPJ', 'KP', 'J')

Then it gives a new string 'timanti' and 'JPLJPJPJ'  in result window . From the above output it is clearly understandable that replace function replace all the matching occurrence of a given string or character. While using Stuff function we can change the specified range of a string

  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Facebook Updates

Guruji Point

Categories

Comman table Expression in SQL Dynamic Grid Row IQueryable in c# Learn AngularJS Scope_Identity() Use of indexes comma seperated string in sql row_number() and dense_rank() salary table structure. while loop in sql why do we need cursor why tuple used

About Us

This blog is about the Programming ,Tech News and some intresting facts related Contents. Here you can find fundamental and expert level topic of programming languages very practically related to C# , Asp.Net ,Sql-Server, JavaScript, Jquery, WebServices And also Web-Api, WCF ,WPF, Angular Js.

Contact Us

Email Us - gurujipoints@gmail.com
Contact- 8077657477

Reach Us

Copyright © Guruji Point - Code You Want To Write