all groups > sql server dts > february 2004 >
You're in the

sql server dts

group:

Output to multiple text files


Output to multiple text files Jason Callas
2/20/2004 11:46:13 AM
sql server dts:
Based on a single query, I need to output the row data to different files
depending on a specific column value. For example:

Query results

Symbol Shares Exchange
--------- -------- ----------
MSFT 1000 XNAS --> write to XNAS.csv
DIA 500 XNYS --> write to DIA.csv
AAPL 750 XNAS --> write to XNAS.csv

I am not sure how to set this up. My initial thought was to set up a
destination for a text file. Then in the ActiveX Main function to write out
the data to the actual file then exit out of function telling DTS to skip
the record. This would work but I am hoping for a cleaner solution.

Any thoughts?

Thanks,
Jason

Re: Output to multiple text files Allan Mitchell
2/20/2004 8:27:20 PM
Is this all stored in a database in which you can issue SQL Statements with
a WHERE Clause. Yes? Use n individual datapump tasks. It will be quicker.

--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]

Re: Output to multiple text files Darren Green
2/21/2004 10:24:57 AM
In message <#hmgH8#9DHA.1392@tk2msftngp13.phx.gbl>, Allan Mitchell
<allan@no-spam.sqldts.com> writes
[quoted text, click to view]

I would use the WHERE clause option, but I'd be tempted to use a single
DataPump task, and drive it of a recordset in a loop. Have a look at
this sample, but replace the bulk export task with a DataPump, and
parameterise the WHERE clause filter.
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org
Re: Output to multiple text files Jason Callas
2/24/2004 11:56:11 AM
My problem is that I do not know beforehand what n would be. So I would not
know how many datadumps to create. (Unless I got a distinct list and
dynamically went through list creating pumps)

- Jason

[quoted text, click to view]

Re: Output to multiple text files Darren Green
2/24/2004 7:01:20 PM
In message <eYSpccv#DHA.1452@TK2MSFTNGP09.phx.gbl>, Jason Callas
<JayCallas@hotmail.com> writes
[quoted text, click to view]


Not knowing n, but assuming the structure is always the same makes this
perfect for a loop, as above.

There are several loop examples on the site, and also examples of using
recordsets to drive them.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org
AddThis Social Bookmark Button