In this article I am going to explain sql server REPLACE function.
In previous article I have explained sql server TRIM function, sql server reversefunction, how to create chart using Google chart API in MVC and how to createmultiselect dropdown with checkbox using Bootstrap multiselect Jquery plugin.
Replace function is used to replace string with another string. It can be a single or multiple characters.
REPLACE ( string_expression , string_pattern , string_replacement )
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.'
What do you think about this article?
If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.