Latest Post

Monday, 3 October 2016

How to use REPLACE() function in Sql Server

Sql REPLACE() function 

Sql REPLACE() function is used to replace text inside a string in SQL Server. It is easy to use and very useful with update statement

Syntax:-

REPLACE( Input_string, string_to_replace, replacement_string )

Example:-

below statement, the REPLACE function will replace some text from string

SELECT Replace('code-view is good site for developer!', 'good', 'excellent')

it will give below output

code-view is very excellent site for developer!

REPLACE function can be use with UPDATE statement as below


Update EMPLOYEE Set  City = replace(city, 'Noida', 'Lucknow');

Government Jobs