Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Data into Multiple Text Files - How? 1

Status
Not open for further replies.

eb24

Programmer
Dec 17, 2003
240
US
I need to export over a million rows of data into a text file. When I do this, the file is too big (~200 MB) and even if I zip it, it is still too big since I have to send this data via email somewhere.

What is the easiest way to export this data to multiple text files?
 
does the table have a unique key? An Integer, Date, Code type field that is unique if you have it. If not, and if possible, create an Int field and set it to and Identity column. When you save the table, from within the designer, it will populate that field sequentially.

Now in your DTS package put a WHERE clause in you SELECT statement something to the effect of ...
Code:
SELECT *
FROM MyTable
WHERE NewID Between 1 and 200000 -- or larger, your choice

Now run it for the first time. When it completes, either rename the file that was created in whatever share you pointed to ... or change the destination file name in the connection portion of your DTS package.

When you are done, drop the new ID column if you no longer need it.

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top