Question:
I need to know how to write SQL to ask for a date range and run the query on that range. Can you help me?
Answer:
I think it makes the most sense to structure your job as a procedure, then you’ll at least have the benefit of declaring the @startdate and @enddate that are the case for your query.
Next, you’ll need to apply the BETWEEN predicate to limit the result set; words to the effect”WHERE mydate BETWEEN(@startdate,@enddate)” should do it for you.