Hi,
According to the ANSI standard
a timetamp - a timestamp == an Interval
a timestamp can be a date, time or timestamp field
an interval can have may different UNITS
year
month
day
hour
minute
second
year to month
day to hour
day to minute
day to second
hour to minute
hour to second
minute to second
the one of interest to me is Day.
select date1 - date2 day(4);
This allows a range of -9999 to 9999 days.
select date1 - date2 day(5);
^
|
isn't allowed.....
Why does ANSI limit it to 9999 days? This basically limits the Day interval to about 27 years.
What if you need to know the number of days between 2 dates and it is greater than 27 years?
Is there some ANSI SQL that given 2 date fields can calculate the number of days between them without having to worry about this 27 year limit?
I know ODBC provides some functions for calulating the number of Days since the beginning of the georgian calander or 1900 and a few vendors may provide extensions to ANSI to provide this functionality, but...
This is the ANSI SQL forum and I want to know if there is an ANSI SQL compliant way to solve this issue.
--
According to the ANSI standard
a timetamp - a timestamp == an Interval
a timestamp can be a date, time or timestamp field
an interval can have may different UNITS
year
month
day
hour
minute
second
year to month
day to hour
day to minute
day to second
hour to minute
hour to second
minute to second
the one of interest to me is Day.
select date1 - date2 day(4);
This allows a range of -9999 to 9999 days.
select date1 - date2 day(5);
^
|
isn't allowed.....
Why does ANSI limit it to 9999 days? This basically limits the Day interval to about 27 years.
What if you need to know the number of days between 2 dates and it is greater than 27 years?
Is there some ANSI SQL that given 2 date fields can calculate the number of days between them without having to worry about this 27 year limit?
I know ODBC provides some functions for calulating the number of Days since the beginning of the georgian calander or 1900 and a few vendors may provide extensions to ANSI to provide this functionality, but...
This is the ANSI SQL forum and I want to know if there is an ANSI SQL compliant way to solve this issue.
--