dbTalk Databases Forums  

Capturing Execute SQL Task result information

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


Discuss Capturing Execute SQL Task result information in the microsoft.public.sqlserver.dts forum.



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

Default Capturing Execute SQL Task result information - 02-15-2005 , 11:47 AM






How do I get the result string from a "Execute SQL Task". Say I have a SQL
statement "DELETE FROM TBL_X"
I run my DTS package and 50 records are deleted. Or it could be an UPDATE
and 50 records changed.

Query Analyzer reports this in the message tab. I would like to get this
"Message" from the task. I have a ActiveX script Task I use to collect other
pieces of information, but not this.
--

G. Stark
MIS
Electro Rent Corp.



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

Default Re: Capturing Execute SQL Task result information - 02-15-2005 , 01:54 PM






In an ExecuteSQL task here is what I did to get the amount of rows
affected by a DELETE statement

SET NOCOUNT ON
delete from X
select @@RowCount as A


I then map A to a global variable in my package and do with it as I
please


Allan

"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

Quote:
How do I get the result string from a "Execute SQL Task". Say I have a
SQL
statement "DELETE FROM TBL_X"
I run my DTS package and 50 records are deleted. Or it could be an
UPDATE
and 50 records changed.

Query Analyzer reports this in the message tab. I would like to get
this
"Message" from the task. I have a ActiveX script Task I use to collect
other
pieces of information, but not this.
--

G. Stark
MIS
Electro Rent Corp.


Reply With Quote
  #3  
Old   
G Stark
 
Posts: n/a

Default Re: Capturing Execute SQL Task result information - 02-16-2005 , 03:16 PM



Not getting results. I added gvA to the packages global variable list.

Added SET NOCOUNT ON, and SELECT @@RowCount as gvA
to the Execute SQL Task

In a ActiveX Script I use
gvA = DTSGlobalVariables("gvA").Value
and can see the gvA is not being effected by Execute SQL Task

Would you expand on what you meant by "map" A to a global variable

G. Stark

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

Quote:
In an ExecuteSQL task here is what I did to get the amount of rows
affected by a DELETE statement

SET NOCOUNT ON
delete from X
select @@RowCount as A


I then map A to a global variable in my package and do with it as I
please


Allan

"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

How do I get the result string from a "Execute SQL Task". Say I have a
SQL
statement "DELETE FROM TBL_X"
I run my DTS package and 50 records are deleted. Or it could be an
UPDATE
and 50 records changed.

Query Analyzer reports this in the message tab. I would like to get
this
"Message" from the task. I have a ActiveX script Task I use to collect
other
pieces of information, but not this.
--

G. Stark
MIS
Electro Rent Corp.




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

Default Re: Capturing Execute SQL Task result information - 02-16-2005 , 03:31 PM



OK

Type the statement I had into an ExecuteSQL window.
Hit the Parameters button
This is an output parameter | Row Value
If you do not already have a Global Variable defined then create one
here (Bottom Right)
Make sure after you do this that it appears alongside your expression
(gvA)

When you press run this will through the value in gvA into the Global
Variable

Add An Active Script task after the ExecuteSQL task and join them using
an On Success precedence constraint

In the text of the Task enter


MsgBox DTSGlobalVariables("gvA").Value


Let me know if that helps


Allan




"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

Quote:
Not getting results. I added gvA to the packages global variable list.

Added SET NOCOUNT ON, and SELECT @@RowCount as gvA
to the Execute SQL Task

In a ActiveX Script I use
gvA = DTSGlobalVariables("gvA").Value
and can see the gvA is not being effected by Execute SQL Task

Would you expand on what you meant by "map" A to a global variable

G. Stark

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:ub2oPe5EFHA.2452 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
In an ExecuteSQL task here is what I did to get the amount of rows
affected by a DELETE statement

SET NOCOUNT ON
delete from X
select @@RowCount as A


I then map A to a global variable in my package and do with it as I
please


Allan

"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

How do I get the result string from a "Execute SQL Task". Say I have
a
SQL
statement "DELETE FROM TBL_X"
I run my DTS package and 50 records are deleted. Or it could be an
UPDATE
and 50 records changed.

Query Analyzer reports this in the message tab. I would like to get
this
"Message" from the task. I have a ActiveX script Task I use to
collect
other
pieces of information, but not this.
--

G. Stark
MIS
Electro Rent Corp.



Reply With Quote
  #5  
Old   
G Stark
 
Posts: n/a

Default Re: Capturing Execute SQL Task result information - 02-16-2005 , 04:10 PM



That works for me. I didn't know about the Parameter Property.
Thank you very much. :-)

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

Quote:
OK

Type the statement I had into an ExecuteSQL window.
Hit the Parameters button
This is an output parameter | Row Value
If you do not already have a Global Variable defined then create one
here (Bottom Right)
Make sure after you do this that it appears alongside your expression
(gvA)

When you press run this will through the value in gvA into the Global
Variable

Add An Active Script task after the ExecuteSQL task and join them using
an On Success precedence constraint

In the text of the Task enter


MsgBox DTSGlobalVariables("gvA").Value


Let me know if that helps


Allan




"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

Not getting results. I added gvA to the packages global variable list.

Added SET NOCOUNT ON, and SELECT @@RowCount as gvA
to the Execute SQL Task

In a ActiveX Script I use
gvA = DTSGlobalVariables("gvA").Value
and can see the gvA is not being effected by Execute SQL Task

Would you expand on what you meant by "map" A to a global variable

G. Stark

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:ub2oPe5EFHA.2452 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
In an ExecuteSQL task here is what I did to get the amount of rows
affected by a DELETE statement

SET NOCOUNT ON
delete from X
select @@RowCount as A


I then map A to a global variable in my package and do with it as I
please


Allan

"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

How do I get the result string from a "Execute SQL Task". Say I
have
a
SQL
statement "DELETE FROM TBL_X"
I run my DTS package and 50 records are deleted. Or it could be an
UPDATE
and 50 records changed.

Query Analyzer reports this in the message tab. I would like to get
this
"Message" from the task. I have a ActiveX script Task I use to
collect
other
pieces of information, but not this.
--

G. Stark
MIS
Electro Rent Corp.





Reply With Quote
  #6  
Old   
G Stark
 
Posts: n/a

Default Re: Capturing Execute SQL Task result information - 02-22-2005 , 12:34 PM



This was good for the rowcount result for a select, insert, delete, and
update.

For a SELECT, I would now like to get the data (w/header). How does one do
that?

SELECT c.CATALOG_DTL_ID as 'Bad MFR_NAME', c.MFR_NAME as AA, g.MFR_NAME as
BB FROM AA.ATA.dbo.CATALOG_DTL c, BB.ATA.dbo.CATALOG_DTL g WHERE
c.CATALOG_DTL_ID = g.CATALOG_DTL_ID and c.MFR_NAME != g.MFR_NAME

--

G. Stark <mailto: gstark (AT) electrorent (DOT) com>
MIS
Electro Rent Corp.
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
In an ExecuteSQL task here is what I did to get the amount of rows
affected by a DELETE statement

SET NOCOUNT ON
delete from X
select @@RowCount as A


I then map A to a global variable in my package and do with it as I
please


Allan

"G Stark" <NoSpam (AT) nospam (DOT) com> wrote

How do I get the result string from a "Execute SQL Task". Say I have a
SQL
statement "DELETE FROM TBL_X"
I run my DTS package and 50 records are deleted. Or it could be an
UPDATE
and 50 records changed.

Query Analyzer reports this in the message tab. I would like to get
this
"Message" from the task. I have a ActiveX script Task I use to collect
other
pieces of information, but not this.
--

G. Stark
MIS
Electro Rent Corp.




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.