/*Set up test table and data */IF OBJECT_ID('dbo.#test') IS NOT NULL BEGIN DROP TABLE #test END CREATE TABLE #test ( test_col VARCHAR(10) ) DECLARE @int INTEGER, @string VARCHAR(10) SET @int = 0WHILE @int <=223 BEGIN IF LEN(@string) < 10 OR @string IS NULL BEGIN SET @string = ISNULL(@string, '') + CHAR(FLOOR(RAND(@int) * @int + 1)) END ELSE Begin INSERT INTO #test SELECT @string SET @string = '' END SET @int = @int + 1 END/*Return all the rows*/SELECT * FROM #test AS T/*Return the rows that return non-alphanumeric characters.*/SELECT *FROM #test AS TWHERE test_col LIKE '%[^a-z]%' AND test_col LIKE '%[^0-9]%' AND test_col LIKE '%[^A-Z]%'
SELECT *FROM#frUser_Copy WHERE[UserName] LIKE '%[^a-z0-9]%'
[UserName] LIKE '%[^a-z]%' AND
[UserName] LIKE '%[^0-9]%' AND
[UserName] LIKE '%[^A-Z]%'