?
Solved

DTS - dynamic filename on runtime

Posted on 2000-04-19
2
Medium Priority
?
3,065 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
[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
2 Comments
 
LVL 1

Accepted Solution

by:
ca_heckler earned 70 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
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…
Suggested Courses

800 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