Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

CASE statement - forum topic by cheeli

$
0
0

Hi experts,
Can you please let me know one the below behavior.

select 
case when 1=1 then
cast('00010101' as timestamp format 'YYYYMMDD') 
end

O/P:  1/1/0001 00:00:00.000000

select 
case when 1=1 then
cast('00010101' as timestamp format 'YYYYMMDD') 
else
cast('00010101' as date format 'YYYYMMDD') 
end

O/P: 1/1/0001


select 
case when 1=2 then
cast('00010101' as timestamp format 'YYYYMMDD') 
else
cast('00010101' as date format 'YYYYMMDD') 
end

O/P: 1/1/0001
Strangely, I could see that even though the second query in which 1=1 is true, it looks like it is executing the else part.  Any insights on this will be helpful.
 

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>