Link to home
Start Free TrialLog in
Avatar of MDWinter
MDWinter

asked on

Find fields that contain non-alpha characters

We have a table within a database that stores codes for our different advertisers.

We used to allow our users to update themselves, but they kept using non-alpha characters in the code.

I now want to tidy up the table by deleting/fixing the fields which contain non alphanumeric characters.

What's the correct query to find them? Can you replace the ??? in my code below:
SELECT sr_code, sr_name 
FROM source 
WHERE ??? 
order by sr_code asc;

Open in new window

Avatar of theGhost_k8
theGhost_k8
Flag of India image

not regexp '[0-9a-z]';
SELECT sr_code, sr_name
FROM source
WHERE FIELD_NAME not regexp '[0-9a-z]'
order by sr_code asc;
WHERE sr_code REGEXP '[A-Z][a-z]'
sorry mine is wrong I added for the one with alpha
Avatar of MDWinter
MDWinter

ASKER

Think I might have been unclear. I used the code that theGhost suggested (attached for clarity) but got zero results.

I want any field that CONTAINS a non alpha character. Not any field that contains ONLY non-alphas.

I know for a fact that one of the records has a value of T@ set for sr_code. This should be found by my query...
SELECT sr_code, sr_name
FROM source
WHERE sr_code not regexp '[0-9a-z]'
order by sr_code asc

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You are a gentleman sir!