Solved

Dynamically change the filename in a dts package.

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

734 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