Solved

MS SQL - UPDATE STATEMENT - LOOK FOR ' AND REPLACE

Posted on 2008-06-13
3
4,208 Views
Last Modified: 2013-11-05
Been fighting with sql and continually get errors when running this statement.

UPDATE [FSSINC].[dbo].[Customer]
   SET [CustomerName] = CustomerName
 WHERE <,,> i add the criteria. What im trying to do is search for say instances where
firstname , lastname remove the , so i end up with just firstname lastname.
0
Comment
Question by:MarkMaloney
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
rickchild earned 500 total points
ID: 21781399
If you are looking to remove all commas then use REPLACE

UPDATE [FSSINC].[dbo].[Customer]
   SET [CustomerName] = REPLACE(CustomerName,  ','  ,  '' )  
0
 
LVL 13

Assisted Solution

by:rickchild
rickchild earned 500 total points
ID: 21781417
If you are looking to replace single quotes (As the question title)

UPDATE [FSSINC].[dbo].[Customer]
   SET [CustomerName] = REPLACE(CustomerName,  ''''  ,  '' )
0
 

Author Comment

by:MarkMaloney
ID: 21781475
thanks folks. worked perfectly
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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