dbTalk Databases Forums  

Output to multiple text files

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Output to multiple text files in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jason Callas
 
Posts: n/a

Default Output to multiple text files - 02-20-2004 , 10:46 AM






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



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Output to multiple text files - 02-20-2004 , 02:27 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


"Jason Callas" <JayCallas (AT) hotmail (DOT) com> wrote

Quote:
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





Reply With Quote
  #3  
Old   
Darren Green
 
Posts: n/a

Default Re: Output to multiple text files - 02-21-2004 , 04:24 AM



In message <#hmgH8#9DHA.1392 (AT) tk2msftngp13 (DOT) phx.gbl>, Allan Mitchell
<allan (AT) no-spam (DOT) sqldts.com> writes
Quote:
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.

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



Reply With Quote
  #4  
Old   
Jason Callas
 
Posts: n/a

Default Re: Output to multiple text files - 02-24-2004 , 10:56 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

"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote

Quote:
In message <#hmgH8#9DHA.1392 (AT) tk2msftngp13 (DOT) phx.gbl>, Allan Mitchell
allan (AT) no-spam (DOT) sqldts.com> writes
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.


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




Reply With Quote
  #5  
Old   
Darren Green
 
Posts: n/a

Default Re: Output to multiple text files - 02-24-2004 , 01:01 PM



In message <eYSpccv#DHA.1452 (AT) TK2MSFTNGP09 (DOT) phx.gbl>, Jason Callas
<JayCallas (AT) hotmail (DOT) com> writes
Quote:
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

"Darren Green" <darren.green (AT) reply-to-newsgroup-sqldts (DOT) com> wrote in message
news:$J+LLhA5HzNAFwEb (AT) sqldts (DOT) com...
In message <#hmgH8#9DHA.1392 (AT) tk2msftngp13 (DOT) phx.gbl>, Allan Mitchell
allan (AT) no-spam (DOT) sqldts.com> writes
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.


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



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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.