Solved

Dynamically change the filename in a dts package.

Posted on 2007-03-27
4
218 Views
Last Modified: 2013-11-30
I have a dts package that simply imports a text file into an existing sql 2000 table.  What I am trying to find out is how to run this package in VB6.  In addition to running the dts package weekly, the files have a different name each time and the package will need to be able to dynamically change the file name that it is importing via VB6.  How do I do this?
0
Comment
Question by:mhopeman
  • 3
4 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18810226
It depends what is driving the DTS Package.  Is the name random but always in the same folder?  Is the name passed in or can it be determined?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 18810233
Also, how are you executing the DTS package from VB6?
0
 

Author Comment

by:mhopeman
ID: 18810300
Actually I am a newbie to this so you will have to bare with me.  I have an existing DTS package that I manually run every week that imports a text file into an existing  SQL table.  I was just notified that I will have more text files that will be needed to be imported into the same table but will not share the same file name but will share the same file structure.  I was told to find a way to run the DTS package in VB and also be able to dynamically change the file name being imported so that I do not have to create a new package for each file.  I would simply use the one original package and just swap file names.  Again, this process is all manual and has yet to be even started in VB.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 125 total points
ID: 18812821
Ok see if this helps. In order to set the text file name you have a couple of options:
1. Use the Dynamic Properties Task: to set the value of the DataSource property for the text file Connection.
2. (My preference) is to use an ActiveX Script Task to set the same property as in:

Function Main()
Dim Pkg

Set Pkg = DTSGlobalVariables.Parent
Pkg.Connections("Text File Connection Name").DataSource = "The full path to your text file goes here"
Set Pkg = Nothing

Main = DTSTaskExecResult_Success

End Function

In either case, you need to ensure that the workflow is set up so that these tasks are executed before the Transform Data task.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

831 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