SELECT specific characters from column SQL

Viewed 2495

I have column name BOOKNAME in BOOKS table which can contain many special characters apart from alphanumeric e.g. ',$#()[],

How can I write a query to show me only special characters in ALL rows and union them e.g.

Row number Book name   
1           Alice$inWonder(Land)
2           Tom Harry#$%^& adventures

So the query should show output like $()#%^&

I tried this but cannot see why it does not show only these characters

SELECT replace(BOOKNAME , '%[^a-zA-Z0-9 ]%', '') FROM BOOKS 
WHERE BOOKNAME like '%[^a-zA-Z0-9 ]%'
3 Answers
Related