Hi frnds...can any one help me regarding this que..
We have column in a table name it as C1 WHICH CONTAIN
ALPHANUMERIC AND NUMERIC VALUES.
C1
2A
2B
2V
2H
1
2
3
4
5
i want to retrive numeric values like 1,2,3,4,5
How we can get
Plz let me know.Thanks in advance
Answer Posted / tdguy
Assuming the column to be char(2), we can use the following
sql to retrieve the numeric values.
SEL C1 FROM
(SEL C1,
CASE
WHEN SUBSTR(C1,1,1) IN
('1','2','3','4','5','6','7','8','9','0')
THEN 'N'
WHEN SUBSTR(C1,1,1) IN (' ')
THEN 'S'
END AS ONE,
CASE
WHEN SUBSTR(C1,2,1) IN
('1','2','3','4','5','6','7','8','9','0')
THEN 'N'
WHEN SUBSTR(C1,2,1) IN (' ')
THEN 'S'
END AS TWO FROM STUD2
) A
WHERE ((A.ONE='N' AND A.TWO='N')
OR
(A.ONE='N' AND A.TWO='S')
OR
(A.ONE='S' AND A.TWO='N'))
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
How many codd's rules are satisfied by teradata database?
How can you track login parameters of users in teradata?
What is the command in bteq to check for session settings ?
If I wanted to run a TPump job only once per day - basically working on a file that is produced once per day - how would you set up the parameters for that sort of job ?
How do you create tables? Exact syntax, and create profiles, users in teradata?
How many sessions of MAX is PE capable of handling at a particular time?
What is the opening step in basic teradata query script?
What is TPD?
What are the 5 phases in a multiload utility?
What is called partitioned primary index (ppi) and discuss the advantages of using it in a query?
In Teradata, how do we Generate Sequence?
What are the joins in teradata?
What is the difference between union and union all in teradata?
Explain the most common data types used in teradata?
Why does varchar occupy 2 extra bytes?