dbTalk Databases Forums  

SP output to a text file using DTS

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


Discuss SP output to a text file using DTS in the microsoft.public.sqlserver.dts forum.



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

Default SP output to a text file using DTS - 09-14-2005 , 11:57 AM






I really need a solution a.s.a.p. so I am stating my case from the stand
point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that allows them to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier to a stored
procedure and return the results to an asp page. This has worked fine for 2
years. Now there is an issue because the file is too large for IIS to buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records that might
be downloaded by the user. If the number is under a predetermined threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id, date of
request and I create a filename and I insert this information into a table.

Objective:
I want to schedule DTS to read the unique id and filename from the table
and generate a text file with the results from the stored procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the table and
populates the global variables with the unique id and the filename.
I created an Active X task thinking this is how to write a text file.
I have an Execute SQL Task that executes the stored procedure but I need to
pass the unique id and I need to output the results to a text file.

So what I need is a solution that is clear to understand for me, I am new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and effort in
helping me reach a working solution.

Thank you
Gary


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

Default Re: SP output to a text file using DTS - 09-14-2005 , 01:43 PM






As I have said earlier. What does the Text file look like? Why is it
that a datapump will not work for you? Are you presenting the info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote


Quote:
I really need a solution a.s.a.p. so I am stating my case from the stand
point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that allows them
to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier to a
stored
procedure and return the results to an asp page. This has worked fine
for 2
years. Now there is an issue because the file is too large for IIS to
buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records that
might
be downloaded by the user. If the number is under a predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id, date of
request and I create a filename and I insert this information into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from the table
and generate a text file with the results from the stored procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the table and
populates the global variables with the unique id and the filename.
I created an Active X task thinking this is how to write a text file.
I have an Execute SQL Task that executes the stored procedure but I need
to
pass the unique id and I need to output the results to a text file.

So what I need is a solution that is clear to understand for me, I am
new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and effort in
helping me reach a working solution.

Thank you
Gary


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

Default Re: SP output to a text file using DTS - 09-14-2005 , 02:01 PM




Here is an example of the text file:
customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the SQL task to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:

Quote:
As I have said earlier. What does the Text file look like? Why is it
that a datapump will not work for you? Are you presenting the info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:

I really need a solution a.s.a.p. so I am stating my case from the stand
point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that allows them
to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier to a
stored
procedure and return the results to an asp page. This has worked fine
for 2
years. Now there is an issue because the file is too large for IIS to
buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records that
might
be downloaded by the user. If the number is under a predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id, date of
request and I create a filename and I insert this information into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from the table
and generate a text file with the results from the stored procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the table and
populates the global variables with the unique id and the filename.
I created an Active X task thinking this is how to write a text file.
I have an Execute SQL Task that executes the stored procedure but I need
to
pass the unique id and I need to output the results to a text file.

So what I need is a solution that is clear to understand for me, I am
new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and effort in
helping me reach a working solution.

Thank you
Gary



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

Default Re: SP output to a text file using DTS - 09-14-2005 , 02:56 PM



Ok

So from your previous post I presume this

The ExecuteSQL task gets you the name of a file and you pass in an ID.
In your example I actually think that this returns all the data as well
which is not what we want here.


You will not be using the ExecuteSQL task to do the pump to the text
file.

Set up a pump to a text file by specifying the SP that returns the data
you want to have in the text file.
Use this article to see how you can pass in a parameter and variable
(id)

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


You will also need to change the name of the text file and for that you
can use this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)


You will use the Global variable values.


Your package will look something like this



ExecuteSQL task
Quote:

Active Script task (sets the text file name)


DataPump task



Points to consider.

The ExecuteSQL task if it simply gets a Filename could be brought inside
the asp page and passed into the package through the object model

Active Script task. If this just sets the filename then again you can
do this in the asp code by manipulating the connections collection

The datapump task you could change the SourceSQLStatement to be what you
want here i.e. proc with variable value.


Allan




"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote


Quote:
Here is an example of the text file:
customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the SQL task
to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:


As I have said earlier. What does the Text file look like? Why is it
that a datapump will not work for you? Are you presenting the info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:


I really need a solution a.s.a.p. so I am stating my case from the
stand
point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that allows
them
to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier to a
stored
procedure and return the results to an asp page. This has worked
fine
for 2
years. Now there is an issue because the file is too large for IIS
to
buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records that
might
be downloaded by the user. If the number is under a predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id, date
of
request and I create a filename and I insert this information into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from the
table
and generate a text file with the results from the stored procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the table
and
populates the global variables with the unique id and the filename.
I created an Active X task thinking this is how to write a text
file.
I have an Execute SQL Task that executes the stored procedure but I
need
to
pass the unique id and I need to output the results to a text file.

So what I need is a solution that is clear to understand for me, I
am
new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and effort
in
helping me reach a working solution.

Thank you
Gary





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

Default Re: SP output to a text file using DTS - 09-14-2005 , 05:21 PM



Here is what I have done so far.
1.)Create a connection to my sql 2k database
2.)Create a Text File(destination) connection to a text file located on my
local drive.
3.) Create the globalvariables at the package level called gvcompid, and
gvFilename
4.)Create a Execute SQL Task to read from the table in sql and popluate the
global variable (this works fine)
5.)Select the transform data task and select my db connection then my text
file connection and create the arrow.
6.) double click the transform task and enter my stored procedure that
extracts the database from the database. I used the ? and mapped the gvCompid
to it.
7.) I ran the package and the text file was created but with the fake name I
prpovided when I created the text file in the first place.
8.) Created an ActiveX script task and followed the example in the document
(http://www.sqldts.com/default.aspx?200)
This errors out with error "system cannot find file specified"
So, that is where I am at to this point.
I appreciate you help and look forward to completing this.

As far as moving things inside the asp page and that type of stuff, I would
much rather get this wotking and then come back and address those issues.
Gary


"Allan Mitchell" wrote:

Quote:
Ok

So from your previous post I presume this

The ExecuteSQL task gets you the name of a file and you pass in an ID.
In your example I actually think that this returns all the data as well
which is not what we want here.


You will not be using the ExecuteSQL task to do the pump to the text
file.

Set up a pump to a text file by specifying the SP that returns the data
you want to have in the text file.
Use this article to see how you can pass in a parameter and variable
(id)

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


You will also need to change the name of the text file and for that you
can use this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)


You will use the Global variable values.


Your package will look something like this



ExecuteSQL task
|
|
Active Script task (sets the text file name)
|
|
DataPump task



Points to consider.

The ExecuteSQL task if it simply gets a Filename could be brought inside
the asp page and passed into the package through the object model

Active Script task. If this just sets the filename then again you can
do this in the asp code by manipulating the connections collection

The datapump task you could change the SourceSQLStatement to be what you
want here i.e. proc with variable value.


Allan




"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CEBD5ED2-BA7D-42D7-9D3B-71BF070D630A (AT) microsoft (DOT) com:

Here is an example of the text file:
customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the SQL task
to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:


As I have said earlier. What does the Text file look like? Why is it
that a datapump will not work for you? Are you presenting the info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:


I really need a solution a.s.a.p. so I am stating my case from the
stand
point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that allows
them
to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier to a
stored
procedure and return the results to an asp page. This has worked
fine
for 2
years. Now there is an issue because the file is too large for IIS
to
buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records that
might
be downloaded by the user. If the number is under a predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id, date
of
request and I create a filename and I insert this information into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from the
table
and generate a text file with the results from the stored procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the table
and
populates the global variables with the unique id and the filename.
I created an Active X task thinking this is how to write a text
file.
I have an Execute SQL Task that executes the stored procedure but I
need
to
pass the unique id and I need to output the results to a text file.

So what I need is a solution that is clear to understand for me, I
am
new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and effort
in
helping me reach a working solution.

Thank you
Gary






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

Default Re: SP output to a text file using DTS - 09-14-2005 , 06:08 PM



Well you are nearly there

So the only part we are missing is #8

What is probably happening is that there is maybe a slight disrepancy
with the location.

After you have assigned the new text file connection name in the Active
Script task can you MsgBox out what the value was? This should help to
try and identifiy why there may be a problem.

The Ax script must go before the datapump


Allan

"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote


Quote:
Here is what I have done so far.
1.)Create a connection to my sql 2k database
2.)Create a Text File(destination) connection to a text file located on
my
local drive.
3.) Create the globalvariables at the package level called gvcompid, and
gvFilename
4.)Create a Execute SQL Task to read from the table in sql and popluate
the
global variable (this works fine)
5.)Select the transform data task and select my db connection then my
text
file connection and create the arrow.
6.) double click the transform task and enter my stored procedure that
extracts the database from the database. I used the ? and mapped the
gvCompid
to it.
7.) I ran the package and the text file was created but with the fake
name I
prpovided when I created the text file in the first place.
8.) Created an ActiveX script task and followed the example in the
document
(http://www.sqldts.com/default.aspx?200)
This errors out with error "system cannot find file specified"
So, that is where I am at to this point.
I appreciate you help and look forward to completing this.

As far as moving things inside the asp page and that type of stuff, I
would
much rather get this wotking and then come back and address those
issues.
Gary


"Allan Mitchell" wrote:


Ok

So from your previous post I presume this

The ExecuteSQL task gets you the name of a file and you pass in an ID.
In your example I actually think that this returns all the data as
well
which is not what we want here.


You will not be using the ExecuteSQL task to do the pump to the text
file.

Set up a pump to a text file by specifying the SP that returns the
data
you want to have in the text file.
Use this article to see how you can pass in a parameter and variable
(id)

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


You will also need to change the name of the text file and for that
you
can use this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)


You will use the Global variable values.


Your package will look something like this



ExecuteSQL task
|
|
Active Script task (sets the text file name)
|
|
DataPump task



Points to consider.

The ExecuteSQL task if it simply gets a Filename could be brought
inside
the asp page and passed into the package through the object model

Active Script task. If this just sets the filename then again you can
do this in the asp code by manipulating the connections collection

The datapump task you could change the SourceSQLStatement to be what
you
want here i.e. proc with variable value.


Allan




"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CEBD5ED2-BA7D-42D7-9D3B-71BF070D630A (AT) microsoft (DOT) com:


Here is an example of the text file:
customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the SQL
task
to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:



As I have said earlier. What does the Text file look like? Why
is it
that a datapump will not work for you? Are you presenting the
info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:



I really need a solution a.s.a.p. so I am stating my case from
the

stand

point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that
allows

them

to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier
to a
stored
procedure and return the results to an asp page. This has worked

fine

for 2
years. Now there is an issue because the file is too large for
IIS

to

buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records
that
might
be downloaded by the user. If the number is under a
predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id,
date

of

request and I create a filename and I insert this information
into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from
the

table

and generate a text file with the results from the stored
procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the
table

and

populates the global variables with the unique id and the
filename.
I created an Active X task thinking this is how to write a text

file.

I have an Execute SQL Task that executes the stored procedure
but I

need

to
pass the unique id and I need to output the results to a text
file.

So what I need is a solution that is clear to understand for me,
I

am

new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and
effort

in

helping me reach a working solution.

Thank you
Gary








Reply With Quote
  #7  
Old   
Gary
 
Posts: n/a

Default Re: SP output to a text file using DTS - 09-14-2005 , 07:00 PM




I get a blank msgbox. so the activex script is not running before the
transform. so how do I get it to run in the correct order?

Thanks
"Allan Mitchell" wrote:

Quote:
Well you are nearly there

So the only part we are missing is #8

What is probably happening is that there is maybe a slight disrepancy
with the location.

After you have assigned the new text file connection name in the Active
Script task can you MsgBox out what the value was? This should help to
try and identifiy why there may be a problem.

The Ax script must go before the datapump


Allan

"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:ED2C0858-85A6-4E48-99BE-277675DEC114 (AT) microsoft (DOT) com:

Here is what I have done so far.
1.)Create a connection to my sql 2k database
2.)Create a Text File(destination) connection to a text file located on
my
local drive.
3.) Create the globalvariables at the package level called gvcompid, and
gvFilename
4.)Create a Execute SQL Task to read from the table in sql and popluate
the
global variable (this works fine)
5.)Select the transform data task and select my db connection then my
text
file connection and create the arrow.
6.) double click the transform task and enter my stored procedure that
extracts the database from the database. I used the ? and mapped the
gvCompid
to it.
7.) I ran the package and the text file was created but with the fake
name I
prpovided when I created the text file in the first place.
8.) Created an ActiveX script task and followed the example in the
document
(http://www.sqldts.com/default.aspx?200)
This errors out with error "system cannot find file specified"
So, that is where I am at to this point.
I appreciate you help and look forward to completing this.

As far as moving things inside the asp page and that type of stuff, I
would
much rather get this wotking and then come back and address those
issues.
Gary


"Allan Mitchell" wrote:


Ok

So from your previous post I presume this

The ExecuteSQL task gets you the name of a file and you pass in an ID.
In your example I actually think that this returns all the data as
well
which is not what we want here.


You will not be using the ExecuteSQL task to do the pump to the text
file.

Set up a pump to a text file by specifying the SP that returns the
data
you want to have in the text file.
Use this article to see how you can pass in a parameter and variable
(id)

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


You will also need to change the name of the text file and for that
you
can use this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)


You will use the Global variable values.


Your package will look something like this



ExecuteSQL task
|
|
Active Script task (sets the text file name)
|
|
DataPump task



Points to consider.

The ExecuteSQL task if it simply gets a Filename could be brought
inside
the asp page and passed into the package through the object model

Active Script task. If this just sets the filename then again you can
do this in the asp code by manipulating the connections collection

The datapump task you could change the SourceSQLStatement to be what
you
want here i.e. proc with variable value.


Allan




"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CEBD5ED2-BA7D-42D7-9D3B-71BF070D630A (AT) microsoft (DOT) com:


Here is an example of the text file:
customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the SQL
task
to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:



As I have said earlier. What does the Text file look like? Why
is it
that a datapump will not work for you? Are you presenting the
info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:



I really need a solution a.s.a.p. so I am stating my case from
the

stand

point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that
allows

them

to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier
to a
stored
procedure and return the results to an asp page. This has worked

fine

for 2
years. Now there is an issue because the file is too large for
IIS

to

buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records
that
might
be downloaded by the user. If the number is under a
predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id,
date

of

request and I create a filename and I insert this information
into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from
the

table

and generate a text file with the results from the stored
procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the
table

and

populates the global variables with the unique id and the
filename.
I created an Active X task thinking this is how to write a text

file.

I have an Execute SQL Task that executes the stored procedure
but I

need

to
pass the unique id and I need to output the results to a text
file.

So what I need is a solution that is clear to understand for me,
I

am

new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and
effort

in

helping me reach a working solution.

Thank you
Gary









Reply With Quote
  #8  
Old   
Gary
 
Posts: n/a

Default Re: SP output to a text file using DTS - 09-15-2005 , 12:20 AM



I have finally managed to get the dts package to function correctly.
Thanks to all the help from Allan Mitchell.



"Gary" wrote:

Quote:
I get a blank msgbox. so the activex script is not running before the
transform. so how do I get it to run in the correct order?

Thanks
"Allan Mitchell" wrote:

Well you are nearly there

So the only part we are missing is #8

What is probably happening is that there is maybe a slight disrepancy
with the location.

After you have assigned the new text file connection name in the Active
Script task can you MsgBox out what the value was? This should help to
try and identifiy why there may be a problem.

The Ax script must go before the datapump


Allan

"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:ED2C0858-85A6-4E48-99BE-277675DEC114 (AT) microsoft (DOT) com:

Here is what I have done so far.
1.)Create a connection to my sql 2k database
2.)Create a Text File(destination) connection to a text file located on
my
local drive.
3.) Create the globalvariables at the package level called gvcompid, and
gvFilename
4.)Create a Execute SQL Task to read from the table in sql and popluate
the
global variable (this works fine)
5.)Select the transform data task and select my db connection then my
text
file connection and create the arrow.
6.) double click the transform task and enter my stored procedure that
extracts the database from the database. I used the ? and mapped the
gvCompid
to it.
7.) I ran the package and the text file was created but with the fake
name I
prpovided when I created the text file in the first place.
8.) Created an ActiveX script task and followed the example in the
document
(http://www.sqldts.com/default.aspx?200)
This errors out with error "system cannot find file specified"
So, that is where I am at to this point.
I appreciate you help and look forward to completing this.

As far as moving things inside the asp page and that type of stuff, I
would
much rather get this wotking and then come back and address those
issues.
Gary


"Allan Mitchell" wrote:


Ok

So from your previous post I presume this

The ExecuteSQL task gets you the name of a file and you pass in an ID.
In your example I actually think that this returns all the data as
well
which is not what we want here.


You will not be using the ExecuteSQL task to do the pump to the text
file.

Set up a pump to a text file by specifying the SP that returns the
data
you want to have in the text file.
Use this article to see how you can pass in a parameter and variable
(id)

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


You will also need to change the name of the text file and for that
you
can use this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)


You will use the Global variable values.


Your package will look something like this



ExecuteSQL task
|
|
Active Script task (sets the text file name)
|
|
DataPump task



Points to consider.

The ExecuteSQL task if it simply gets a Filename could be brought
inside
the asp page and passed into the package through the object model

Active Script task. If this just sets the filename then again you can
do this in the asp code by manipulating the connections collection

The datapump task you could change the SourceSQLStatement to be what
you
want here i.e. proc with variable value.


Allan




"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CEBD5ED2-BA7D-42D7-9D3B-71BF070D630A (AT) microsoft (DOT) com:


Here is an example of the text file:
customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the SQL
task
to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:



As I have said earlier. What does the Text file look like? Why
is it
that a datapump will not work for you? Are you presenting the
info in
the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:



I really need a solution a.s.a.p. so I am stating my case from
the

stand

point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that
allows

them

to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique identifier
to a
stored
procedure and return the results to an asp page. This has worked

fine

for 2
years. Now there is an issue because the file is too large for
IIS

to

buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of records
that
might
be downloaded by the user. If the number is under a
predetermined
threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique id,
date

of

request and I create a filename and I insert this information
into a
table.

Objective:
I want to schedule DTS to read the unique id and filename from
the

table

and generate a text file with the results from the stored
procedure.

Currently in place:
I have a package with a Execute SQL Task that Reads from the
table

and

populates the global variables with the unique id and the
filename.
I created an Active X task thinking this is how to write a text

file.

I have an Execute SQL Task that executes the stored procedure
but I

need

to
pass the unique id and I need to output the results to a text
file.

So what I need is a solution that is clear to understand for me,
I

am

new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time and
effort

in

helping me reach a working solution.

Thank you
Gary









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

Default Re: SP output to a text file using DTS - 09-15-2005 , 12:30 AM



Use workflow

Have a look here

Introduction to Workflow
(http://www.sqldts.com/default.aspx?287)


Allan

"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote


Quote:
I get a blank msgbox. so the activex script is not running before the
transform. so how do I get it to run in the correct order?

Thanks
"Allan Mitchell" wrote:


Well you are nearly there

So the only part we are missing is #8

What is probably happening is that there is maybe a slight disrepancy
with the location.

After you have assigned the new text file connection name in the
Active
Script task can you MsgBox out what the value was? This should help
to
try and identifiy why there may be a problem.

The Ax script must go before the datapump


Allan

"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:ED2C0858-85A6-4E48-99BE-277675DEC114 (AT) microsoft (DOT) com:


Here is what I have done so far.
1.)Create a connection to my sql 2k database
2.)Create a Text File(destination) connection to a text file located
on
my
local drive.
3.) Create the globalvariables at the package level called gvcompid,
and
gvFilename
4.)Create a Execute SQL Task to read from the table in sql and
popluate
the
global variable (this works fine)
5.)Select the transform data task and select my db connection then
my
text
file connection and create the arrow.
6.) double click the transform task and enter my stored procedure
that
extracts the database from the database. I used the ? and mapped the
gvCompid
to it.
7.) I ran the package and the text file was created but with the
fake
name I
prpovided when I created the text file in the first place.
8.) Created an ActiveX script task and followed the example in the
document
(http://www.sqldts.com/default.aspx?200)
This errors out with error "system cannot find file specified"
So, that is where I am at to this point.
I appreciate you help and look forward to completing this.

As far as moving things inside the asp page and that type of stuff,
I
would
much rather get this wotking and then come back and address those
issues.
Gary


"Allan Mitchell" wrote:



Ok

So from your previous post I presume this

The ExecuteSQL task gets you the name of a file and you pass in an
ID.
In your example I actually think that this returns all the data as

well

which is not what we want here.


You will not be using the ExecuteSQL task to do the pump to the
text
file.

Set up a pump to a text file by specifying the SP that returns the

data

you want to have in the text file.
Use this article to see how you can pass in a parameter and
variable
(id)

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


You will also need to change the name of the text file and for
that

you

can use this

How can I change the filename for a text file connection?
(http://www.sqldts.com/default.aspx?200)


You will use the Global variable values.


Your package will look something like this



ExecuteSQL task
|
|
Active Script task (sets the text file name)
|
|
DataPump task



Points to consider.

The ExecuteSQL task if it simply gets a Filename could be brought

inside

the asp page and passed into the package through the object model

Active Script task. If this just sets the filename then again you
can
do this in the asp code by manipulating the connections collection

The datapump task you could change the SourceSQLStatement to be
what

you

want here i.e. proc with variable value.


Allan




"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CEBD5ED2-BA7D-42D7-9D3B-71BF070D630A (AT) microsoft (DOT) com:



Here is an example of the text file:

customername|address|city|state|zip|phone|item|shi pdate|promiseddate
Mike Lamp|1343 west st.|WA|90780|1112223333|33|08132005|08202005
Mary Adams|5546 North
Ave.|AT|87899|4443335555|21|09102005|09172005

That is basicly the format of the text file.
You asked "Why is it that a datapump will not work for you? "
I don't know what you mean or how to feed the results from the
SQL

task

to a
datapump.
The file is downloaded as a zip file, if that helps.

Thanks in advance.

"Allan Mitchell" wrote:




As I have said earlier. What does the Text file look like?
Why

is it

that a datapump will not work for you? Are you presenting the

info in

the file in a non row/column format?


allan



"Gary" <Gary (AT) discussions (DOT) microsoft.com> wrote in message
news:CB69A8F3-5F9F-4234-A45E-DC5FE6867056 (AT) microsoft (DOT) com:




I really need a solution a.s.a.p. so I am stating my case
from

the


stand


point of what it is I am trying to do and what I have done.
Overview:
When a person comes into our website there is a feature that

allows


them


to
generate a text file of information based on who they are.

Initial action:
The way I implemented this was to pass their unique
identifier

to a

stored
procedure and return the results to an asp page. This has
worked


fine


for 2
years. Now there is an issue because the file is too large
for

IIS


to


buffer
the file for some people.

New development:
I have redesigned the asp page to detect the number of
records

that

might
be downloaded by the user. If the number is under a

predetermined

threshold
then the current method of downloading stays in effect.
If the number is above the threshold then I save the unique
id,

date


of


request and I create a filename and I insert this
information

into a

table.

Objective:
I want to schedule DTS to read the unique id and filename
from

the


table


and generate a text file with the results from the stored

procedure.


Currently in place:
I have a package with a Execute SQL Task that Reads from the

table


and


populates the global variables with the unique id and the

filename.

I created an Active X task thinking this is how to write a
text


file.


I have an Execute SQL Task that executes the stored
procedure

but I


need


to
pass the unique id and I need to output the results to a
text

file.


So what I need is a solution that is clear to understand for
me,

I


am


new at
DTS, and hopefully some step by step examples.

I realize this is asking a lot but I appreciate your time
and

effort


in


helping me reach a working solution.

Thank you
Gary











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.