Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

logging output from Execute T-SQL task Expand / Collapse
Author
Message
Posted Thursday, January 10, 2013 1:30 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, March 21, 2014 2:32 PM
Points: 25, Visits: 178
I have a Execute T-SQL task which purged records from table. I would like to record in a log file the record count of how many records where deleted. Is this done by turning logging on?
Post #1405629
Posted Thursday, January 10, 2013 1:44 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 12:24 PM
Points: 4,828, Visits: 11,183
bobd125 (1/10/2013)
I have a Execute T-SQL task which purged records from table. I would like to record in a log file the record count of how many records where deleted. Is this done by turning logging on?


Your ExecuteSQL task needs to return the count, which you can map to a package variable.

The way in which you do this depends on the exact SQL you have written, but @@rowcount might be your friend.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1405634
Posted Sunday, January 13, 2013 9:19 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 9:25 AM
Points: 7,070, Visits: 12,523
Here is a tutorial on how you might be able to capture the number of affected rows into a variable, depending on how your SQL Statement in your Execute SQL Task is constructed.

http://microsoft-ssis.blogspot.com/2011/03/rowcount-for-execute-sql-statement.html


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1406472
Posted Sunday, January 13, 2013 9:45 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 4:00 PM
Points: 35,967, Visits: 30,258
bobd125 (1/10/2013)
I have a Execute T-SQL task which purged records from table. I would like to record in a log file the record count of how many records where deleted. Is this done by turning logging on?


Not sure why you're using SSIS for such a simple thing. Just write a stored procedure and have it capture the rowcount(s) in a log table.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

"Change is inevitable. Change for the better is not." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1406565
Posted Monday, January 14, 2013 6:59 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 9:25 AM
Points: 7,070, Visits: 12,523
Jeff Moden (1/13/2013)
bobd125 (1/10/2013)
I have a Execute T-SQL task which purged records from table. I would like to record in a log file the record count of how many records where deleted. Is this done by turning logging on?


Not sure why you're using SSIS for such a simple thing. Just write a stored procedure and have it capture the rowcount(s) in a log table.

That would seem to require a decision to shift where the logging took place since the original question talked about a log file. If you wanted the log data to a table, but later bring the information out to a file so it could be emailed (typical case) then I guess that could be a compromise.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1406698
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse