Advertisement

03.06.2006 at 10:14AM PST, ID: 21762572
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

Passing DTS variables from one Package to Another

Asked by 99Times in MS SQL Server

Tags: , , ,

I will do my best at trying to explain this.

I have about 200 different text files that I am importing into the same staging table
So in my first DTS package I build a Queue table with the names of the text files (they are all in the same directory)
along with some other data not relevant to the problem.

I capture the Count of this Queue table and store it as a Global Variable.

So, the first DTS gets the Filename from the Queue, then renames the file and imports into the Raw Table,
then deletes that entry from the Queue and then decrements the Count. This package loops until all
the files in the Queue have been processed.

The last step of the 1st Package calls the 2nd DTS package which puts the Data from the Raw table to
a Staging Table.

All this works perfectly.

My problem comes in the last step of the 2nd package.  I am passing the Count Variable from the
first package to the 2nd package (using an Outer Global Variable, I think that is right).  The last step of the 2nd package
is the final processing script which I don't want to execute until all records in the Queue have been
processed.

So the next to last step in the 2nd DTS is an ActiveX task:

Function Main()
 
Dim oPkg

Set oPkg = DTSGlobalVariables.Parent
      
      IF DTSGlobalVariables("LoopCount").Value > 1 Then
            oPkg.Steps(DTSStep_DTSExecuteSQLTask_2).ExecutionStatus = DTSStepExecStat_Inactive
            Main = DTSTaskExecResult_Success
      Else
            
      End If

      Main = DTSTaskExecResult_Success
End Function

So I only want to process the last Step (DTSStep_DTSExecuteSQLTask_2) of the 2nd package when the Count Variable = 1

The Error I am getting is on the ActiveX Task: Step ordinal '0' (base 1) is out of range.

Any help would be appreciated, let me know if you need more information.
Start Free Trial
 
Loading Advertisement...
 
[+][-]03.06.2006 at 10:18AM PST, ID: 16116853

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: dts, ordinal, out, variable
Sign Up Now!
Solution Provided By: acperkins
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.06.2006 at 10:36AM PST, ID: 16117022

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44