Peet Pienaar
asked on
Return Alpha values from a ID field
I need to pull out only the alpha characters from an ID file not numeric values, but this returns the numeric values as well
Please assist have found the following for DB2
SELECT CIN, NATIONAL_ID,FNAME,MNAME,LN AME1,LNAME 2
FROM Prodmgr.T_Consumer
WHERE CIN NOT IN (SELECT CIN FROM Prodmgr.T_REPORT_CONSUMER)
and NATIONAL_ID not like '%?%?'
and ( National_ID not in '%A%'or National_ID LIKE '%B%'or National_ID LIKE '%C%'
or National_ID LIKE '%D%'or National_ID LIKE '%E%'or National_ID LIKE '%F%'
or National_ID LIKE '%G%'or National_ID LIKE '%H%'or National_ID LIKE '%I%'
or National_ID LIKE '%J%'or National_ID LIKE '%K%'or National_ID LIKE '%L%'
or National_ID LIKE '%M%'or National_ID LIKE '%N%'or National_ID LIKE '%O%'
or National_ID LIKE '%P%'or National_ID LIKE '%R%'or National_ID LIKE '%S%'
or National_ID LIKE '%T%'or National_ID LIKE '%U%'or National_ID LIKE '%V%'
or National_ID LIKE '%w%'or National_ID LIKE '%X%'or National_ID LIKE '%Y%'
or National_ID LIKE '%Z%')
ORDER by National_ID DESC;
Please assist have found the following for DB2
SELECT CIN, NATIONAL_ID,FNAME,MNAME,LN
FROM Prodmgr.T_Consumer
WHERE CIN NOT IN (SELECT CIN FROM Prodmgr.T_REPORT_CONSUMER)
and NATIONAL_ID not like '%?%?'
and ( National_ID not in '%A%'or National_ID LIKE '%B%'or National_ID LIKE '%C%'
or National_ID LIKE '%D%'or National_ID LIKE '%E%'or National_ID LIKE '%F%'
or National_ID LIKE '%G%'or National_ID LIKE '%H%'or National_ID LIKE '%I%'
or National_ID LIKE '%J%'or National_ID LIKE '%K%'or National_ID LIKE '%L%'
or National_ID LIKE '%M%'or National_ID LIKE '%N%'or National_ID LIKE '%O%'
or National_ID LIKE '%P%'or National_ID LIKE '%R%'or National_ID LIKE '%S%'
or National_ID LIKE '%T%'or National_ID LIKE '%U%'or National_ID LIKE '%V%'
or National_ID LIKE '%w%'or National_ID LIKE '%X%'or National_ID LIKE '%Y%'
or National_ID LIKE '%Z%')
ORDER by National_ID DESC;
Do you have a pattern, I.e. The non numeric values only appear in a specific locations?
What is the DB ms SQL or db2?
What are you using to extract and display this informations?i.e. Can the masking/extraction/changes be done by the rendering process asp, php, etc.
I.e get the entire ID from the DB and then process the results in the event the rendering software includes straight forward tools to extract only the non-numeric values.
What is the DB ms SQL or db2?
What are you using to extract and display this informations?i.e. Can the masking/extraction/changes
I.e get the entire ID from the DB and then process the results in the event the rendering software includes straight forward tools to extract only the non-numeric values.
ASKER
HI Manju
DB2 does not seem to like the replace function
@ Arnold
There is no patterns, the placings is random
Not sure if the masking etc can work ? We using DB2 to extract the data
DB2 does not seem to like the replace function
@ Arnold
There is no patterns, the placings is random
Not sure if the masking etc can work ? We using DB2 to extract the data
with db2...,
how about below sample
...
where
columna = replace(columna, ' ', '?')
and
translate(columna, ' ',
'ABCDEFGHIJKLMNOPQRSTUVWXY Z'
|| Lcase('ABCDEFGHIJKLMNOPQRS TUVWXYZ') ) = ' '
how about below sample
...
where
columna = replace(columna, ' ', '?')
and
translate(columna, ' ',
'ABCDEFGHIJKLMNOPQRSTUVWXY
|| Lcase('ABCDEFGHIJKLMNOPQRS
ASKER
Hi there Manju
That is working, thank you so much, is it correct to bring back full names, as i know in some rows we do have space and then alpha characters
Thank you
Kind regards
That is working, thank you so much, is it correct to bring back full names, as i know in some rows we do have space and then alpha characters
Thank you
Kind regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
REPLACE(REPLACE(REPLACE(RE