Solved

Dynamically change the filename in a dts package.

Posted on 2007-03-27
4
232 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
[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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
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 how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

749 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