Solved

MySQL script to strip out non numeric

Posted on 2011-09-14
4
412 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
  • 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 500 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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…

785 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