SQL query for finding rows with special characters only SQL query for finding rows with special characters only sql sql

SQL query for finding rows with special characters only


SELECT    TemplateID,    BodyFROM    #TemplateWHERE    Body LIKE '%[^0-9a-zA-Z ]%'

The stuff between the brackets says numbers (0-9), lowercase alphas (a-z), uppercase alphas (A-Z) and the space. The "^" makes that a "NOT" one of these things. Note that this is different though than NOT LIKE '%[0-9a-zA-Z ]%'