Posts

Showing posts from June, 2013

Find special characters from the column of the table

Below is the simple SQL query to find those records from the table that contain special characters. Simply create a table, insert some data into it containing special characters or copy and paste the below code in to query window and execute. DECLARE @data AS TABLE ( RecordId INT IDENTITY , TextData VARCHAR ( 100 )) INSERT INTO @data ( TextData ) VALUES ( 'hello abc' ), ( 'hello $hyam' ), ( 'testing % char' ), ( 'hello ram' ), ( 'hello.' ), ( 'testing # now' ), ( 'testing @ now and ! also' ), ( 'why lefting ^me and & me too' ) SELECT * FROM    @data WHERE   TextData LIKE '%[^a-zA-Z0-9,.()* ]%'