Solved

SQL Script to remove specific character from a column

Posted on 2008-06-18
4
667 Views
Last Modified: 2010-04-21
I need to remove a "-" from data in a table column. It's a chart number where they have three didgits followed by a dash and then two more digits. There are thousands of them so doing it one by one would be very time consuming. Hoping a scipt would be possible. Table = Patient, Colunm = Chart. Any help would be greatly appreciated. Thanks in Advance.
0
Comment
Question by:wdabbs
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 21817378
update Patient
set Chart = replace('-','',Chart )
where chart like '%-%'
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 21817379
simple UPDATE:
UPDATE Patient
   SET Chart = REPLACE(Chart, '-', '')
 WHERE Chart LIKE '%-%'

Open in new window

0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 250 total points
ID: 21817386
update Patient
set Chart = replace(Chart ,'-','')
where chart like '%-%'
0
 

Author Closing Comment

by:wdabbs
ID: 31468587
Awesome... simply awesome.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Caste datetime 2 64
kill process lock Sql server 9 63
SQL Server Insert where not exists 24 46
convert null in sql server 12 46
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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