[sql] How to detect if a string contains special characters?

How to detect if a string contains special characters like #,$,^,&,*,@,! etc (non-alphanumeric characters) in SQL server 2005?

This question is related to sql sql-server

The answer is


In postgresql you can use regular expressions in WHERE clause. Check http://www.postgresql.org/docs/8.4/static/functions-matching.html

MySQL has something simmilar: http://dev.mysql.com/doc/refman/5.5/en/regexp.html


SELECT * FROM tableName WHERE columnName LIKE "%#%" OR columnName LIKE "%$%" OR (etc.)