Reputation: 4713
I have a table in PostgreSQL and I need to detect if a column contains special characters like #,$,^,&,*,@,!
etc. or is empty.
For example the table might be like this
How to write a query like this?
Upvotes: 9
Views: 31699
Reputation: 4713
Finally i got the solution
select * from table where column1 ~* '[^a-z0-9]' or column2 ~* '[^a-z0-9]' or column3 ~* '[^a-z0-9]'
Upvotes: 27