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
Different phases of multiload?
Why is the case expression used in teradata?
Let us say there is a file that consists of 100 records out of which we need to skip the first and the last 20 records. What will the code snippet?
Give a justifiable reason why Multi-load supports NUSI instead of USI.
How many codd's rules are satisfied by teradata database?
Highlight the differences between Primary Key and Primary Index.
What are the components used in smp and massively parallel processing (mpp) machines?
What is upsert statement in teradata?
In general, how do you optimze any sql in teradata?
Explain teradata utilities?
What is spool space? Why do you get spool space errors? How do trouble-shoot them?
How do you define Teradata?
Highlight the points of differences between the database and user in Teradata.
how do you manage the production space. what are the proactive methods you can take ?
How to select first n records in teradata?