![]() |
|
|
#1 |
|
Senior Member
Join Date: Jul 2004
Posts: 167
|
How to sanitize data with one mysql statement?
I have a table that should contain only alphanumeric data. I want to user only SQL to update any record that has nonalphanumeric data and make that field blank. Is there a way to do this?
|
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2004
Posts: 167
|
Re: How to sanitize data with one mysql statement?
Another thing I'd like to do is within the mysql statement, to take multiple spaces and make them one space.
|
|
|
|
|
|
#3 |
|
Member
Join Date: Nov 2004
Posts: 31
|
Re: How to sanitize data with one mysql statement?
Perhaps you could use regex http://dev.mysql.com/doc/mysql/en/regexp.html to check for non-alphanumeric data like:
UPDATE table SET col = '' WHERE col REGEXP '[^[:alnum:]]'; |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jul 2004
Posts: 167
|
Re: How to sanitize data with one mysql statement?
Ah, I saw that they had something but couldn't make out the sytax. I was look ing at the wrong page. Thank you.
I've been using your tools and they've been very helpful. They are on all my servers now ![]() |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Import Access, Excel and data of other formats to MySQL by Navicat | NavicatGuy | Articles | 0 | 08-17-2004 01:08 AM |
| 3.2 Entering Queries | Administrator | Documentation | 0 | 06-09-2004 02:58 AM |
| 1.7 MySQL Information Sources | Administrator | Documentation | 8 | 06-08-2004 02:58 AM |
| 1.2.2 The Main Features of MySQL | Administrator | Documentation | 0 | 06-08-2004 01:55 AM |
| 1.2 Overview of the MySQL Database Management System | Administrator | Documentation | 0 | 06-07-2004 10:11 PM |