Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 07 Sep 2011 @ 07:45:47 GMT


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


Subj:   Re: Hours Subtraction
 
From:   Diehl, Robert

Problem is 25 won't be a valid hour. So you have to substring it and then subtract 6

Here is an example (many different variations of this technique will work.

     select cast(253042 as decimal(6) format'99:99:99')  as time_col
     ,cast(cast(substring(time_col from 1 for 2 ) as integer) -6
          || substring(time_col from 3 for  6) as time(0))

I believe this will work as long as the Hour is between 6 and 30.

I hope this helps get you started.


Thanks,

Robert Diehl
Travelocity Data Warehouse DBA



     
  <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