0

Needs an update what exactly the below query does when it divisible by 365??

select CAST((FLGHT_DATE )/365 AS INTEGER);

Note: FLGHT_DATE column is of date type and in YYYY-MM-DD format.

Rocky1989
  • 369
  • 8
  • 28
  • 1
    Teradata DATE data type keeps the date internally as an integer: (YEAR - 1900) * 10000 + (MONTH * 100) + DAY. dividing this by 365 doesn't make a lot of sense but I should allow a Teradata expert to offer advice. – tinazmu Mar 01 '22 at 12:52
  • It will return a basically meaningless number. What are you trying to do? – Andrew Mar 01 '22 at 14:56
  • Got the info, we have to use this in our partition by clause, actually in the converted code to snowflake. based on this anwser i can easily convert to snowflake format. Thank you all. – Rocky1989 Mar 01 '22 at 15:25
  • This logic wouldn't make a lot of sense for a Snowflake clustering key. Would be good to understand how you plan on using this for Snowflake. – Mike Walton Mar 02 '22 at 00:08

0 Answers0