Here's a script I wrote for returning fiscal dates. We use the 4-4-5 calendar here at my work, and so my queries often have to reference date ranges that must fall at the start of the correct periods. Our 2002 fiscal calendar started on 9/30/01 and this is used as the offset for calculating all dates.
Basically, you pass this script a date and it will return the fiscal year and period, and also the MTD, YTD, and WTD dates comparable to the passed date. If your fiscal year begins on a different date, then it can be changed in the "Initialize Variables" section. I use SQL7 and it works fine, but I have not tested it on 6.5.
Author: Bill Abreu
Disclaimer: We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
"as -is", without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose...
Back to Database Journal Home