Reputation: 859
I need to write a query to pull values from a column containing only special characters. I know that the below query would give me all values containing at least one special char but that is not what I need. Can anybody help me please?
SAMPLE DATA -
ORG
^^567
~423
%^&/
329
I need to write a query which will return only %^&/
from the above sample data.
SELECT org
FROM table_A
WHERE org like '%[^a-Z0-9]%'
Upvotes: 3
Views: 2221
Reputation: 93754
Try this
SELECT org
FROM table_A
WHERE org Not like '%[a-Z0-9]%'
Demo
SELECT org
FROM (SELECT '1asdasdf' org
UNION
SELECT '$asd#'
UNION
SELECT '$^%$%') a
WHERE org Not Like '%[a-Z0-9]%'
Result: $^%$%
Upvotes: 5