?
Solved

MySQL script to strip out non numeric

Posted on 2011-09-14
4
Medium Priority
?
415 Views
Last Modified: 2012-05-12
Hi,

I have a column with telephone numbers where some fools have put in text and () insdie here. I need a script which I can run that will strip all this rubbish out. I will then need to put this script in a cron job...

Thanks
0
Comment
Question by:andybrooke
[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
  • 3
4 Comments
 
LVL 16

Expert Comment

by:Swadhin Ray
ID: 36536313
0
 
LVL 16

Expert Comment

by:Swadhin Ray
ID: 36536317
let us know if you need any more clarification
0
 

Author Comment

by:andybrooke
ID: 36536748
Will this clean the data? OR just select the data?
0
 
LVL 16

Accepted Solution

by:
Swadhin Ray earned 2000 total points
ID: 36537522
No cleanup just select and return .
instead of passing a sting you can pass the column name but if you want then you can use replacing too like :

## Selecting data

SELECT select uExtractNumberFromString(columnname) FROM table_name WHERE condition;

## For replacing
UPDATE table_name
SET columname = uExtractNumberFromString(columnname);

for updating entire table and for updating columns based on condition then

UPDATE table_name
SET columname = uExtractNumberFromString(columnname)
WHERE condition;
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

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