Solved

MySQL script to strip out non numeric

Posted on 2011-09-14
4
409 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

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.

Join & Write a Comment

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento 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

12 Experts available now in Live!

Get 1:1 Help Now