Solved

MS SQL - UPDATE STATEMENT - LOOK FOR ' AND REPLACE

Posted on 2008-06-13
3
4,217 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
[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 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.

749 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