Here is my current code:
SELECT nature, inci_id, calltime, agency, gp
FROM inmain AS inmain
WHERE (calltime >= CONVERT(DATETIME, '2013-07-01 00:00:00', 102))
AND (calltime <= CONVERT(DATETIME, '2014-06-30 23:59:59', 102))
ORDER BY nature, calltime
I need this to pull data at the end of every fiscal year without going in and changing the date all the time, but I am at a loss as how to make it just change so it is between 7/1/(of the previous year) to 6/30/(of the current year).
We use an automation program to send this out at the end of the fiscal year. That way I don't have to do it manually all the time.
Use datepart year, so your not performing a search on a function I'd reccomend setting up some variables that wil beset prior to the main query running, so your sarg is against a date.