Solved

Dynamically change the filename in a dts package.

Posted on 2007-03-27
4
224 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
I have a large data set and a SSIS package. How can I load this file in multi threading?
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…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

809 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