Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 08 Dec 2004 @ 10:00:57 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: View the date field in dbc.oldpasswords table
 
From:   Dieter Noeth

Mike Vanole wrote:

          ((100 * ((4 * nullifzero(DBASE.PasswordChgDate) - 1) / 146097)
          + (4 * (((4 * DBASE.PasswordChgDate - 1) MOD 146097) / 4)
          + 3) / 1461 - 1900) + ((5 * (((4 * (((4 * DBASE.PasswordChgDate
          - 1) MOD 146097) / 4) + 3) MOD 1461 + 4) / 4) - 3) / 153 + 2)
          / 12) * 10000 + (((5 * (((4 * (((4 * DBASE.PasswordChgDate - 1)
          MOD 146097) / 4) + 3) MOD 1461 + 4) / 4) - 3) / 153 + 2) MOD 12
          + 1) * 100 + ((5 * (((4 * (((4 * DBASE.PasswordChgDate - 1) MOD
          146097) / 4) + 3) MOD 1461 + 4) / 4) - 3) MOD 153 +5) / 5
          (date, format 'yy/mm/dd', NAMED PasswordLastModDate),

I've seen that before, it's copied from dbc.users and similar to sys_calendar.calbasics.day_of_calendar.

Nobody ever dares to find out how it's working :-)

But maybe an old Teradata developer can explain: Is there any real reason why a modified version of the julian period day number is calculated instead of a simple "date_col - staring_date"?

     date '0001-01-01' + (DBASE.PasswordChgDate - 307)

And why that strange calculation for PasswordLastModTime?

     ((SUBSTR(CHAR2HEXINT(dbase.PasswordString),42,1)||
     SUBSTR(CHAR2HEXINT(dbase.PasswordString),44,1))*10000 +
     (SUBSTR(CHAR2HEXINT(dbase.PasswordString),48,1)||
      SUBSTR(CHAR2HEXINT(dbase.PasswordString),50,1))*100 +
     (SUBSTR(CHAR2HEXINT(dbase.PasswordString),54,1)||
      SUBSTR(CHAR2HEXINT(dbase.PasswordString),56,1)))
     (Integer, FORMAT '99:99:99', Named PasswordLastModTime),

It is already a string:

     substring(dbase.PasswordString from 21 for 8)
                 (integer, format '99:99:99')

Dieter



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023