Calculate Difference between time in Teradata

General
Highlighted
Enthusiast

Calculate Difference between time in Teradata

Hi Guys,

 

I want to take difference of 2 date fields but both are varchar field

SyntaxEditor Code Snippet

start_time- 2018-03-02 06:31:22

end_time -  2018-03-02 06:33:32.478000  

I want the result in integer as 2 in min always  and it should be an integer always

Result :- 2

 

It would be very great if anyone can help to achieve my case.

 

Thanks  

1 REPLY
Teradata Employee

Re: Calculate Difference between time in Teradata

BTEQ -- Enter your SQL request or BTEQ command:
SELECT TIMESTAMP '2018-03-02 06:31:22' - TIMESTAMP '2018-03-02 06:33:32.478000' MINUTE(2) "MIN";


*** Query completed. One row found. One column returned.
*** Total elapsed time was 1 second.

MIN
---
-2

 

HTH.

 

Cheers.

 

Carlos.