?
Solved

Find and Replace in table within SQL Server Mangament 2005

Posted on 2007-04-02
3
Medium Priority
?
232 Views
Last Modified: 2010-03-19
Hi, I am working with a table in Microsoft SQL Server Management 2005. I have a nvarchar(254) field where I need to find and replace part of the text and I am not sure how to do this.

Example: This Print on Demand Classic, originally published in 1948, discusses abnormal personality in a way to make it interesting to students new to the subject.

NEEDS to BE this Below:
This Print-on-Demand book, originally published in 1948, discusses abnormal personality in a way to make it interesting to students new to the subject.

Any suggestions on how to replace "Print on Demand Classic" to "Print-on-Demand book" would be great.

Thanks :-)
0
Comment
Question by:Mamea
[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
3 Comments
 
LVL 11

Expert Comment

by:dready
ID: 18840680
Try this. I assumed your table is called myTable, and that the text is in the column title.

update myTable set title = replace(title, 'Print on Demand', 'Print-on-Demand')

0
 
LVL 11

Accepted Solution

by:
dready earned 2000 total points
ID: 18840692
or, to be more precise:

update myTable set title = replace(title, 'Print on Demand Classic', 'Print-on-Demand book')



0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18840862
Or to be more efficient (no points please):
Update myTable
Set title = REPLACE(title, 'Print on Demand Classic', 'Print-on-Demand book')
Where CHARINDEX('Print on Demand Classic', title) > 0

:)
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

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.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

770 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