dateiff function

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Enthusiast

dateiff function

Hi all,

 

nedd help with conversion from SQL to TERA.

(datediff(day,convert(datetime,convert(char(8),LastCommunication)),getdate()) >=3 )

and(datediff(day,FTD_Date,getdate()) between 12 and 20 )

 

Thanks!

 

2 REPLIES
Junior Contributor

Re: dateiff function

It's similar to your previous questions, calculating the difference in days between to Dates/Timestamps:

-- Assuming LastCommunication is a Timestamp and the Converts strip of the time portion?
datediff(day,convert(datetime,convert(char(8),LastCommunication)),getdate())
= CURRENT_DATE - CAST(LastCommunication AS DATE)

datediff(day,FTD_Date,getdate()) 
= CURRENT_DATE - FTD_Date

This is similar to your previous questions, you should be able to solve this on your own by now :-)

 

 

Enthusiast

Re: dateiff function

you right,next time i probably solve it by my own.

Tx!