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.
Tags:
Forums: