I have the following SELECT statement that I am using in SQL Server 2000 that selects additions during a certain timeframe
SELECT *
FROM Facilities
WHERE (approve_datetime BETWEEN '2009-08-01' AND '2009-08-07') AND (action = 'A')
I would like to create a stored procedure on the 1st of every month that would create a file with this information for the previous month. Is there a way to do this so that every month I get the previous months data? (Additionally, if this can be done would the logic be any different if I wanted to run it every sunday for the previous weeks data?)
SELECT *
FROM Facilities
WHERE (approve_datetime BETWEEN '2009-08-01' AND '2009-08-07') AND (action = 'A')
I would like to create a stored procedure on the 1st of every month that would create a file with this information for the previous month. Is there a way to do this so that every month I get the previous months data? (Additionally, if this can be done would the logic be any different if I wanted to run it every sunday for the previous weeks data?)