Sql server REPLACE function | ASPMANTRA | Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server AND WCF snippets and tutorial

Sql server REPLACE function

In this article I am going to explain sql server REPLACE function.


Description:
Replace function is used to replace string with another string.  It can be a single or multiple characters.

Syntax
REPLACE ( string_expression , string_pattern , string_replacement ) 

Example:

        1. Replace single character
select REPLACE('articlemirror','r','1') as 'Replace e.g.'
select REPLACE('articlemirror','rro','123') as 'Replace e.g.'

        2. Replace complete string with another
Select REPLACE('asp.net','asp.net','sql server') as 'Replace e.g.'

v  You can also use replace to remove the blank spaces from a column.
select REPLACE(' articlemirror, asp.net   ,    sql server,    mvc ',' ','') as 'Replace e.g.'

 Result:
Sql server REPLACE function



Post a Comment

[blogger]

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget