Solved

SQL Script to remove specific character from a column

Posted on 2008-06-18
4
664 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
Comment Utility
update Patient
set Chart = replace('-','',Chart )
where chart like '%-%'
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
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
Comment Utility
update Patient
set Chart = replace(Chart ,'-','')
where chart like '%-%'
0
 

Author Closing Comment

by:wdabbs
Comment Utility
Awesome... simply awesome.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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