Home > Archive > MS SQL Server DTS > May 2005 > create text file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author create text file
JFB

2005-05-24, 8:24 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


Allan Mitchell

2005-05-24, 8:24 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@jfb.com> wrote in message news:help@jfb.com:

> 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


JFB

2005-05-24, 8:24 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@no-spam.sqldts.com> wrote in message
news:OqBfvYKYFHA.2128@TK2MSFTNGP15.phx.gbl...
> 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@jfb.com> wrote in message news:help@jfb.com:
>
>



Helge C. Rutz

2005-05-24, 8:24 pm

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

JFB

2005-05-25, 11:23 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@nurfuersp
am.de> wrote in message
news:3fhkjeF7sqcrU1@
individual.net...
> Hi JFB,
>
> "JFB" wrote:
>
> 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



Helge C. Rutz

2005-05-26, 7:23 am

Hi JFB,

"JFB" wrote:
> 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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com