Calling Global Variable in DTS

  • I am using SQL 2000 DTS

    I have 5 folders each having 2-3 text files.

    I have two DTS packages one which is having around 12 tasks which is getting processed based on the records in '.txt' file, now what i need to do is put this entire first package in a LOOP which will get the name of the file from my second package which is saving the file name in a global variable.

    this is my second package which is passing the name of the text file to a global variable -

    For Each objsubfold in foldSubfolders

    for each fil in objsubfold.Files

    DTSGlobalVariables("gv_FileFullName").Value = fil.Name

    Next

    Next

    help needed asap

    Nitin

  • some help needed urgently....

  • Sounds to me like you need to add an Execute Package Task to your 2nd DTS package that will execute the 1st package. Pass the value of the global variable using the Outer Package Global Variables tab in the properties of the Execute Package task. The trick here is that the name of the global variable must be the same in both packages.

    Add this code to your Active X Script task:

    For Each objsubfold in foldSubfolders

    for each fil in objsubfold.Files

    DTSGlobalVariables("gv_FileFullName").Value = fil.Name

    DTSGlobalVariables.Parent.Steps("DTSStep_DTSExecutePackageTask_1").Execute

    Next

    Next

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply