Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS Schedule Parameters month range

Status
Not open for further replies.

Shal2

Programmer
Dec 3, 2001
52
NZ
Hi All,

I have a simple DTS Package which executes a stored procedure and exports the result to an Excel file.

In the stored procedure I use two dates like:

Select * from Table1 where
ScanDate betweeen @StartDate and @EndDate.

Now I want to schedule the DTS Package so that it runs once every month, and in the stored procedure the start and end dates should be the first and last date of the month that the package is being run. (Example if it is scheduled to run on the last day of every month, let's say july 2004, it should take July 1st 2004 as start date and July 31st 2004 as end date for the stored procedure).

Now my question is how can I do this, in the DTS package by passing parameters somehow or should I set these dates inside the stored procedure. Or any other alternative solution. Which is the best approach to do this.

Thank you,
Shal
 
Hi,
If anybody is interested I decided to do it inside the stored procedure. And scheduling the DTS package to run on the first day of every month.

I am setting EndDate to getdate() and startdate to
dateadd(mm,-1,@getdate()).

I guess this will work for me,
thanks,
Shal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top