Subject | Re: udf function |
---|---|
Author | Adam |
Post date | 2007-02-01T00:57:52Z |
Correction to my prior post, you will need to add 10 to the Day number
as well or you will end up with strange results for the first 9 days
of the month.
Also, although YEARDAY may not be appropriate because of leap years,
it gave me an idea on how you can do it.
select *
from MyTable
where Cast(Cast(Extract(Month from <timestamp field>)+10 as Char(2))
|| Cast(Extract(Day from <timestamp field>)+10 as char(2)) as Integer)
between :StartDateFormat and :EndDateFormat.
The date format you would need to use is
Month+10 together with Day+10
For example, to get all records between 3 Feb and 18 Jun:
select *
from MyTable
where Cast(Cast(Extract(Month from <timestamp field>)+10 as Char(2))
|| Cast(Extract(Day from <timestamp field>)+10 as char(2)) as Integer)
between 1213 and 1628
Of course this will hit need to read every record in MyTable, which
may not be pretty.
Adam
as well or you will end up with strange results for the first 9 days
of the month.
Also, although YEARDAY may not be appropriate because of leap years,
it gave me an idea on how you can do it.
select *
from MyTable
where Cast(Cast(Extract(Month from <timestamp field>)+10 as Char(2))
|| Cast(Extract(Day from <timestamp field>)+10 as char(2)) as Integer)
between :StartDateFormat and :EndDateFormat.
The date format you would need to use is
Month+10 together with Day+10
For example, to get all records between 3 Feb and 18 Jun:
select *
from MyTable
where Cast(Cast(Extract(Month from <timestamp field>)+10 as Char(2))
|| Cast(Extract(Day from <timestamp field>)+10 as char(2)) as Integer)
between 1213 and 1628
Of course this will hit need to read every record in MyTable, which
may not be pretty.
Adam