Solved

Script to Output Table as multiple files

Posted on 2007-12-03
2
124 Views
Last Modified: 2013-11-30
Need Script or SSIS package that accept number of files as an argument and then export the table broken into that many files?  
0
Comment
Question by:donnatronious
  • 2
2 Comments
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 20401568
The simplest way be to use some kind of paging SP (there are plenty out there). Based on the number of records, and the number of files, work out how many records each file will have. You then have a bunch of numbers that you can use in:

1. A For Each Loop
2. Inside the for each loop, a data flow which calls the paging SP and gets the records

The for each will also need to alter the output file used by the data flow.

Why do you want to chunk it up?
0
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 500 total points
ID: 20401581
Here's a link to one particular paging solution:

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/Q_22953186.html

Get that working in Management Studio First, then think about the For Each logic.


You can create package variables and assign them from the command line if you want something that will do this from the command line.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now