dbTalk Databases Forums  

DTS File Creation

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


Discuss DTS File Creation in the microsoft.public.sqlserver.dts forum.



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

Default DTS File Creation - 02-24-2005 , 05:58 PM






"I need to create a file with static header info (first record), result
set from a query and static trailer info (last record). Here is an
example:

Header Info (Record 1)
Results from query (record 2)
Results from query (record 3)
....
Trailer Info (Record n)

What is the best way to do this? I can create a file with just the
results from a query, but I can't figure out how to get the header and
trailer info into the file. HELP!"


Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: DTS File Creation - 02-24-2005 , 06:49 PM






There are a few ways you could do this. You can create three
files: a header file, the data file, a trailer file.Then you
can combine the files into the final file using the DOS copy
command with something like:
COPY Header.txt + Data.Txt + Trailer.txt FinalFile.txt
You could use a SQL statement that unions the header, data
and trailer info.
You could also use the Multiphase Data Pump functionality to
do this.

-Sue

On 24 Feb 2005 15:58:30 -0800, "Tim" <rrichards (AT) exabyte (DOT) com>
wrote:

Quote:
"I need to create a file with static header info (first record), result
set from a query and static trailer info (last record). Here is an
example:

Header Info (Record 1)
Results from query (record 2)
Results from query (record 3)
...
Trailer Info (Record n)

What is the best way to do this? I can create a file with just the
results from a query, but I can't figure out how to get the header and
trailer info into the file. HELP!"


Reply With Quote
  #3  
Old   
Rich
 
Posts: n/a

Default Dynamically rename Text File Export with Header Info - 02-28-2005 , 08:39 AM



Hi,

A bit of a variation on the exporting text files with header & trailer info
theme. I currently have a package that exports data from a sql table to a
text file and an ActiveX script that renames the Text File destination
connection at run-time to include the date so that it gets exported as
something like custYYMMDD.txt

I need to add header a trailer and footer record and thought of doing so by
using 3 separate files containing header, data, footer and then using the DOS
copy to combine them: ie. copy header.txt+data.txt+footer.txt final
output.txt - how can I incorporate this into my package and how can I
dynamically rename the final combined file to include the date in the name of
the file?

Any thoughts much appreciated,

Rich

Reply With Quote
  #4  
Old   
Jim James
 
Posts: n/a

Default Re: DTS File Creation - 02-28-2005 , 06:18 PM





Sue, thank you for your input. I need to use the COPY method, but I
can't figure it out. I have all three of my files written, but I'm not
sure how to use th eDOS copy command in ActiveX, like you mentioned.
Can you provide a snippet?

Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #5  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: DTS File Creation - 02-28-2005 , 07:53 PM



If you want to use the DOS copy command, you can use an
execute process task to execute the copy command. Command
would be cmd.exe with the parameters:
/c copy D:\Header.txt+D:\File.txt+D:\Trailer.txt
D:\Final.txt

-Sue

On Mon, 28 Feb 2005 16:18:10 -0800, Jim James
<rrichards (AT) exabyte (DOT) com> wrote:

Quote:

Sue, thank you for your input. I need to use the COPY method, but I
can't figure it out. I have all three of my files written, but I'm not
sure how to use th eDOS copy command in ActiveX, like you mentioned.
Can you provide a snippet?

Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply With Quote
  #6  
Old   
Jim James
 
Posts: n/a

Default Re: DTS File Creation - 03-02-2005 , 02:28 PM



Sue,
You are great. Now I have this package built and doing what I want. I
can execute it fine. I have users that need to be able to execute it.

How do I call this package from a button in ASP.net? I've never worked
in ASP.net before.

TIA.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #7  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: DTS File Creation - 03-02-2005 , 07:40 PM



Hi James,
Glad to hear you got things running! I'm pretty sure the DTS
Cookbook for .Net goes through examples of this. You can
find it at:
http://www.sqldev.net/dts/DotNETCookBook.htm

Hope that helps -

-Sue

On Wed, 02 Mar 2005 12:28:09 -0800, Jim James
<rrichards (AT) exabyte (DOT) com> wrote:

Quote:
Sue,
You are great. Now I have this package built and doing what I want. I
can execute it fine. I have users that need to be able to execute it.

How do I call this package from a button in ASP.net? I've never worked
in ASP.net before.

TIA.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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.