Is there an SQL Server equivalent function to Progress 4GL INTERVAL function ?

Status
Not open for further replies.
C

codeRavi

Guest
I am aware that Progress 4GL version 10 onwards is equipped with an very clever integrated function called 'INTERVAL' which returns the time interval between two DATE, DATETIME, or DATETIME-TZ values. If you use the following syntax,

> DISPLAY INTERVAL(05/06/2014, 05/05/2015, "years").


would give you zero as it is one day short for it to be counted as one year.

But in SQL, the closet function can be used in relation to this would be DATEDIFF and you would not be able to get the same result. In SQL Server the following query,


PRINT DATEDIFF(YEAR, '05/06/2014', '05/05/2015');

would still print one instead of zero ignoring the bit that it is still one day short to be counted as a year. Therefore my question is would there be an integrated function in SQL which could be used to achieve the same result like Progress 4GL ?

Continue reading...
 
Status
Not open for further replies.
Top