dbTalk Databases Forums  

create text file

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


Discuss create text file in the microsoft.public.sqlserver.dts forum.



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

Default create text file - 05-24-2005 , 04:12 PM






Hi All,
I have to create a report text file but in special format base on
information from a tables data.
The text file I need to create it in a particular folder with this format:
Report Date 5/24/2005

Batch: 001
From position: 532
To position: 543
Description: bla bla bla...

How can i do this using DTS? Like you see I have to replace the info with a
info from the table...
I know how to create files using file system object but to replace the
format ???
Tks in advance
JFB



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

Default Re: create text file - 05-24-2005 , 04:21 PM






Whilst this looks like a header is there any conventional data?

If there is you could write a header text file and pump to a data text
file and then do COPY A+B C

If not and your data is simply telling us what we see then it is kinda
not really a native DTS task thing.

Sure we could "massage" it into doing it but that wouldn't be better
than simply writing to a text file with info stored in GVs from your
package using FSO

Allan

"JFB" <help (AT) jfb (DOT) com> wrote


Quote:
Hi All,
I have to create a report text file but in special format base on
information from a tables data.
The text file I need to create it in a particular folder with this format:
Report Date 5/24/2005

Batch: 001
From position: 532
To position: 543
Description: bla bla bla...

How can i do this using DTS? Like you see I have to replace the info with a
info from the table...
I know how to create files using file system object but to replace the
format ???
Tks in advance
JFB


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

Default Re: create text file - 05-24-2005 , 04:25 PM



Well... actually I'm creating this text file every 100 records base on one
column criteria, after this Im creating another text file with the info for
those 100 records.
It's like a header for each file...
Do you have any example?
Tks Allan
JFB

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Whilst this looks like a header is there any conventional data?

If there is you could write a header text file and pump to a data text
file and then do COPY A+B C

If not and your data is simply telling us what we see then it is kinda not
really a native DTS task thing.

Sure we could "massage" it into doing it but that wouldn't be better than
simply writing to a text file with info stored in GVs from your package
using FSO

Allan

"JFB" <help (AT) jfb (DOT) com> wrote


Hi All,
I have to create a report text file but in special format base on
information from a tables data.
The text file I need to create it in a particular folder with this
format:
Report Date 5/24/2005

Batch: 001
From position: 532
To position: 543
Description: bla bla bla...

How can i do this using DTS? Like you see I have to replace the info with
a
info from the table...
I know how to create files using file system object but to replace the
format ???
Tks in advance
JFB




Reply With Quote
  #4  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: create text file - 05-24-2005 , 04:28 PM



Hi JFB,

"JFB" wrote:
Quote:
Hi All,
I have to create a report text file but in special format base on
information from a tables data.
The text file I need to create it in a particular folder with this
format: Report Date 5/24/2005

Batch: 001
From position: 532
To position: 543
Description: bla bla bla...

How can i do this using DTS? Like you see I have to replace the info
with a info from the table...
I know how to create files using file system object but to replace the
format ???
I'm not absolutly sure what you want, but AFAIU you can query the values you need with a sql query task and store them via output
parameter as global variable. Then you can use this inside an activeX task to create the file and write the values to it.

If this should only be the header, you have to create a second file as transform output for data and then copy them together.

HTH
Helge



Reply With Quote
  #5  
Old   
JFB
 
Posts: n/a

Default Re: create text file - 05-25-2005 , 10:55 AM



Tks for you reply Helge,
How can I create a header with that particular format? I want to be able to
replace the values of this file... I don't want to put it together because
I'm going to print this header later.
Rgds
JFB


"Helge C. Rutz" <news050424 (AT) nurfuerspam (DOT) de> wrote

Quote:
Hi JFB,

"JFB" wrote:
Hi All,
I have to create a report text file but in special format base on
information from a tables data.
The text file I need to create it in a particular folder with this
format: Report Date 5/24/2005

Batch: 001
From position: 532
To position: 543
Description: bla bla bla...

How can i do this using DTS? Like you see I have to replace the info
with a info from the table...
I know how to create files using file system object but to replace the
format ???

I'm not absolutly sure what you want, but AFAIU you can query the values
you need with a sql query task and store them via output parameter as
global variable. Then you can use this inside an activeX task to create
the file and write the values to it.

If this should only be the header, you have to create a second file as
transform output for data and then copy them together.

HTH
Helge



Reply With Quote
  #6  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: create text file - 05-26-2005 , 05:03 AM



Hi JFB,

"JFB" wrote:
Quote:
Tks for you reply Helge,
How can I create a header with that particular format? I want to be
able to replace the values of this file... I don't want to put it
together because I'm going to print this header later.
can you please explain what you exactly want to do - I got a little bit confused.
You want a header for one file and replace the values inside?

You can just open a text file inside an activeX task and write values into it.
You just open a File with CreateTextFile() and write the lines with WriteLine(), where you can concatenate the constant strings with
the values from the GVs.
If you want to be able to define the format of this output separatly, then you can define a template file with placeholders which
you then read in line by line, insert the values with replace, and then write the result to your report file.
I'm sorry I have no example for that on hand.

Helge



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.