Solved

Replace a string based on a value in another field

Posted on 2012-03-15
2
333 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now