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
What is basic teradata query language?
What's the difference between timestamp (0) and timestamp (6)?
What is the use of virtual processor connectivity in teradata?
Explain fallback in teradata?
Difference between star and snowflake schemas?
While creating table my dba has fallback or no fallback in his ddl. What is that?
What are the different table types that are supported by teradata?
What is the difference between teradata and oracle?
Highlight the differences between Primary Key and Primary Index.
What happens in a conflict? How do you handle that?
What is the difference between global temporary tables and volatile temporary tables?
What are the different table types supported by teradata?
Which is faster fastload or multiload?
How to run a query in teradata?
What is bteq script in teradata?