How about something like this:
/*
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 = 0
WHILE @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 T
WHERE
test_col LIKE '%[^a-z]%' AND
test_col LIKE '%[^0-9]%' AND
test_col LIKE '%[^A-Z]%'
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question