?
Solved

DTS Package parameter passing

Posted on 2003-02-25
3
Medium Priority
?
925 Views
Last Modified: 2013-11-30
I have been working on a small project to design and use SQL Server DTS packages from the Enterprise Manager DTS Designer and one of my task is to call a DTS packages from another DTS package.  The problem arose with passing parameters (global variables) between them.  

The mechanism that I thought will implement this is using the EXECUTE PACKAGE TASK, and it has a mapping for Inner Package Global Variables and Outer Package Global Variables.  But for some reason, the inner package CANNOT pick up the value I'm passing or mapping to it from the Outer Package Global Variables.

Would you know how I can pass this parameters from the outer package to the inner package (using the Enterprise Manager DTS Designer screen) and without storing the parameters to an external file or table?  

0
Comment
Question by:pespiritu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
bibana2 earned 200 total points
ID: 8020939
One thing you could try doing is using an Active X script to set the global variables into the DTS package you want to call.

EX:

Set oPackage = CreateObject("DTS.Package")
oPackage.LoadFromSQLServer "SERVER NAME", "SERVER USERNAME", "SERVER PASSWORD", DTSSQLStgFlag,"","","","NAME OF PACKAGE"
oPackage.GlobalVariables.Item("GLOBAL_VAR_1") = Some_Data




Then you call the package from within the Active X script.  


oPackage.Execute
oPackage.Uninitialize()
Set oPackage = Nothing




I'm sure there are other ways of doing it, but this way works for me.  Hope it helps.
0
 

Author Comment

by:pespiritu
ID: 8028146
Biban2:
   This solution worked.  I used something like:

Function Main()
     ' OPEN the target package
     Set l_TargetPackage = CreateObject("DTS.Package")
     l_TargetPackage.LoadFromSQLServer "MDROASVRHOMER", "****", "****", DTSSQLStgFlag,"","","","Dataprep Domain DTS"

     ' SET the global variable parameters using the values of the current package
     l_TargetPackage.GlobalVariables.Item("@srce_context") = DTSGlobalVariables("@srce_context")
     l_TargetPackage.GlobalVariables.Item("@dest_context") = DTSGlobalVariables("@dest_context")

     ' EXECUTE the target package
     l_TargetPackage.Execute

     ' CLOSE the target package
     l_TargetPackage.Uninitialize()
     Set l_TargetPackage = Nothing

     Main = DTSTaskExecResult_Success
End Function


It would have been nice if I could do this from the DTS Designer screen without writing any VBS code, but this will get me to the next step for now.  Thanks.

0
 

Expert Comment

by:bibana2
ID: 8028158
Glad it helped.
0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question