Solved

Script to Output Table as multiple files

Posted on 2007-12-03
2
128 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
[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
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how the fundamental information of how to create a table.

735 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