Home Page for the TeradataForum
 
 

 

Archives of the TeradataForum





Message Posted: Thu, 01 Nov 2001 @ 21:14:34 GMT





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




Subj:   Re: User activity monitor
 
From:   Dieter Nöth



Why bothering with weird calculations when you can use INTERVALs???

select
  logondate
  ,logontime
  ,logdate
  ,logdate
  ,(
    cast(logdate as timestamp(0))
    + cast(substring(logtime from 1 for 8) as interval hour to second(0)))
   -
   (cast(logondate as timestamp(0))
    + cast(substring(logontime from 1 for 8) as interval hour to second(0))
    ) day(4) to second (0) as SessionDuration
from dbc.logonoff l
where event in ('logoff', 'forced off')
sample 10

so it's just weird CASTs

Dieter





     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
 
  Top Home Join Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky 
Last Modified: 30 Jun 2008