Solved

Replace a string based on a value in another field

Posted on 2012-03-15
2
341 Views
Last Modified: 2012-03-15
I want to update the FullDescription field based on a value in the Name field :

SELECT Name
FROM  Nop_Product
WHERE (Name LIKE '%(MEN)%')    :

ACQUA DI PARMA by Acqua di Parma (MEN) COLOGNE SPRAY 3.4 OZ

FullDescription field :

<strong>ACQUA DI PARMA by Acqua di Parma</strong> - <span style='font-size:15px;'>Genuine Brand Name Perfume</span><p style='font-size:18px;color:black;padding-top:10px;padding-bottom:10px;'>COLOGNE SPRAY 3.4 OZ</p>Gender : MEN<br /><br />Brand : ACQUA DI PARMA<br /><br />Designer : Acqua di Parma<br /><br />Fragrance : rosemary, citrus, lavender

I want to replace the string : 'Genuine Brand Name Perfume' in FullDescription
with                                       'Genuine Brand Name Fragrance'

WHERE the string '(MEN)' is in the field 'Name'


UPDATE [Nop_Product]
SET  FullDescription =

 WHERE

What's the best way to do this? thanks
0
Comment
Question by:MikeMCSD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 500 total points
ID: 37725713
This does what you asked:

UPDATE [Nop_Product]
SET  FullDescription =  replace(fulldescription,'Genuine Brand Name Perfume' ,'Genuine Brand Name Fragrance')
WHERE Name LIKE '%(MEN)%'

Now let's see where that's going to take us :>)
0
 
LVL 16

Author Closing Comment

by:MikeMCSD
ID: 37726018
thanks
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question