Cleaning up bad data in an SQL database

dp, 02 June 2009, Comments
Categories: Uncategorized
Tags: , ,

Recently, I needed to find all of the data in a table that was being used for HTML output, that had non-printable characters. The following SQL statement should do that for you:

select id, name
from table_name
where name not regexp '^[a-zA-Z0-9_ ,&;\/<>(²):%*#?$|!+.\"\'-]+$;

This code is MySQL specific, but should be applicable anywhere, really.

Related posts:

  1. XFN/FOAF I’ve been working on getting all of the sites on...
  2. Codeblocked: An Adventure in Slow Code It’s amazing how much content a company can add in...

Comments

blog comments powered by Disqus