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 Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023