Archives of the TeradataForum
Message Posted: Fri, 16 Dec 2006 @ 00:41:15 GMT
Subj: | | Re: Looking for bad data |
|
From: | | Vinay Bagare |
Good catch Mike.
I modified for this.
SEL
-- '1234M' AS sno -- CHAR type
'12%5M' AS sno -- CHAR type
,CASE WHEN (UPPER(SUBSTRING(TRIM(sno) FROM 1 FOR 4)) (CASESPECIFIC) =
LOWER(SUBSTRING(TRIM(sno) FROM 1 FOR 4)) (CASESPECIFIC) )
AND SUBSTRING(sno FROM 5 FOR 1) = 'M'
AND CHAR2HEXINT(SUBSTRING( sno FROM 1 FOR 1)) BETWEEN '0030' AND '0039'
AND CHAR2HEXINT(SUBSTRING( sno FROM 2 FOR 1)) BETWEEN '0030' AND '0039'
AND CHAR2HEXINT(SUBSTRING( sno FROM 3 FOR 1)) BETWEEN '0030' AND '0039'
AND CHAR2HEXINT(SUBSTRING( sno FROM 4 FOR 1)) BETWEEN '0030' AND '0039'
THEN 'MATCH' ELSE 'Mis MATCH' END AS "Result"
I think this takes care of all characters.
Vinay
|