LearnItFirst User Forum

SQL Server 2008 DBA Training Videos
Welcome Guest Search | New Posts | Members | Log In | Register

Looping through Variables in DTS Options
zBeare
Posted: Monday, October 13, 2008 10:03:02 PM
Rank: Newbie

Joined: 10/13/2008
Posts: 1
Points: 3
Where do you live?: Melbourne, Down Under
I have a situation where I need to run six rolling month reports and generate six individual text file outputs.

Currently I have SQL that does the job for me. I declare @YEAR variable and @MONTH variable, set the QUERY ANALYSER to output result to File, set a value for each of the two variables and run the SQL six times.

The variables are used in several places throught the SQL to create stagingtables, matching criteria and retrict output. It would also be nice to use them in the output filename (but this is currently manual).

I'm really new at this, but I was hoping I could load all this into a DTS package, set the startMotnh and startYear and have the package then loop through - incrementing by one month six times and then running the extract into discreet files.

I have a sense that this should be done using activeX and global variables and was hoping somone could give me a few pointers.


I suspect that to be used in DTS - rather than having one long SQL script - I will probably need to break it up into steps and run each step as a separte DTS step as well.

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.