Home > Sql Server > Using Replace() function in Sql Server

Using Replace() function in Sql Server


In this article, we will be talking about one of the important inbuilt functions of sql server, Replace()

Syntax:

REPLACE ( string_expression , string_pattern , string_replacement )

Some examples of using replace are as follows:

1)

select replace('Nice Article', 'Nice','Cool')

returns Cool Article

2)

UPDATE emp set designation=replace(designation, 'Sales', 'Marketing') where department='Marketing'
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: