Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

REPLACE exact match in string

$
0
0

Hi,

I am using SQL Server 2008 R2 Standard Edition. My question is:

How to use the REPLACE function (or any other T-SQL function if you have a better suggestion than the REPLACE function) to replace anexact match in a string? For instance, let's say I have this string:'success and successfully'. I would like to change the word "success" to "failure"without changing the word "successfully" to "failurefully". This is exactly what happens when the function REPLACE is used. 

REPLACE('success and successfully', 'success', 'failure')

How to force an exact match?

Thank you!


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>