Q

Generating multiple flat files from a single flat file source

Generating multiple flat files from a single flat file source could be done by first creating a DTS package with Custom Active Script task.

I have a single flat file source containing 1 million (changeable) rows. I want to generate multiple flat files, each containing 30,000 rows. The naming convention for the destination file could be anything as of now. The number of files to generate is not known at design time. Only the number of rows in each file is known. How do I divide my single file into multiple files, each containing 30,000 rows?
It's times like this that I miss some of my favorite Unix utilities. Unix supported the split command, which did exactly what you are looking for! You may want to consider creating a DTS package with the Custom Active Script task, in which you use the Scripting Runtime library's FileSystemObject to split a large text file into multiple small files.
This was first published in May 2006

Dig deeper on Microsoft SQL Server Database Development

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close