2011-09-15

Teradata - Date to YYYYMM integer


cast(
      ( extract( year from DATE_FIELD_HERE ) * 100 )
      + extract( month from DATE_FIELD_HERE )
      as integer
) as PeriodID     

3 comments:

  1. Correct. But there must be a CAST-ing way to do it.

    ReplyDelete
  2. CAST(
    CAST(
    (birth_date (FORMAT 'YYYYMMDD'))
    AS CHAR(8))
    AS INTEGER)


    AS int_yyyymmdd,

    ReplyDelete
    Replies
    1. Anonymous13:12

      Thank you kind human!

      Delete