Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MySQL script to strip out non numeric

Posted on 2011-09-14
4
Medium Priority
?
417 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
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

609 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