Solved

SQL Script to remove specific character from a column

Posted on 2008-06-18
4
666 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 142

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

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