Link to home
Start Free TrialLog in
Avatar of earngreen
earngreenFlag for United States of America

asked on

Record Count In Execute SQL Task

I am trying to log counts of records inserted via a sql task. Can anyone tell me how best to do this. Right now I log counts in the data flow by using VB code in a Scrip Component, but I need to be able to capture counts in the SQL Task.
ASKER CERTIFIED SOLUTION
Avatar of tigin44
tigin44
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A word of caution.
@@ROWCOUNT would be reset for every instance of insert. So, you might have to save it for logging before/after commit.
Avatar of earngreen

ASKER

sameer2010

I am not sure what you mean.
@@ROWCOUNT value changes after every ddl statement. for that reason you should use it immediatly after you run your query or store that value for later use.. this what sameer2010 mean.
Create a stored procedure with an output parameter using the @@RowCount function and get it from a SQLtask inside SSIS.
FOr SQL task details check this link:
http://www.sqlis.com/post/The-Execute-SQL-Task.aspx
helped?
Regards,
Pedro
This worked great. Thanks