Solved

DTS - dynamic filename on runtime

Posted on 2000-04-19
2
3,055 Views
Last Modified: 2013-11-30
I'm using DTS to export from SQL Server to text file(about 1,000,000 rows).
I want to change the target file dynamic from the VB Script on runtime, so i can put only 2,000 rows for each file.
Is there any easy way to do that?
0
Comment
Question by:tomerka
2 Comments
 
LVL 1

Accepted Solution

by:
ca_heckler earned 35 total points
ID: 2731890
You could write your transform to take as a source a Stored Proc that only returns a fraction of your data. Then, from VB or VBA you create a Transformation Object, load your transformation and fire a few times, passing different parameters to the SP
(and changing the target file-name).
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2732105
I did already launch Packages from VB (Scrip), and change connection (including text file connections) settings like the filename.
You could combine this, in creating a DTS that opens your existing package, changes the target filename, and execute the package (your need to control the "next" 2000 rows using a Proc or View using TOP 2000 and a where clause to ensure rows are not returned twice).

To open and execute a package, you need to do somethings like this:
DIM objPackage
SET objPackage = CreateObject("DTS.Package")
objPackage.LoadFromSQLServer ( "here comes a series of parameters like server, packagename, username and password")
objPackage.Execute
Set objPackage = NOTHING

to access/change the connection settings, you need to analyse the package properties, check the Connections collections to find your file, and there you need to change the ConnectionSource (or similar)

Hope this helps




0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtual SQL Server 2014 Standard 35 93
How to union three related tables in one flat file? 8 48
SQL Log size 3 20
MS SQL query to show nearest date 6 42
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how the fundamental information of how to create a table.

830 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