Solved

DTS - dynamic filename on runtime

Posted on 2000-04-19
2
3,054 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 142

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

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 needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

808 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