blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

SSIS Junkie

Conchango are busy and need talented consultants in and around London. Interested? Email me or send me a message

SSIS Nugget: Output the number of processed rows

Here's a handy little tip for when you are building custom destination components or script destination components that enables you to log the number of processed rows.

Have you ever seen that handy little message that appears in your logs that tells you how many rows arrived at a destination component? It looks a little like this:

OnInformation,MachineName,UserName,TaskName,<SourceID-GUID>,<ExecutionID-GUID>,<Timestamp>,7/3/2007 12:08:01 PM,1074016267,0x,"component "ComponentName" (31)" wrote 987654 rows.

You'll still get the same message for your custom destinations and script destinations except that the number of rows will always be zero, regardless of how many rows were actually processed. If you would like to put something meanigful in there then it only takes one line of code. A call to IDTSComponentMetadata90.IncrementPipelinePerfCounter() is all that is required. Here's the code shown in the Input0_ProcessInputRow() method of the script component:

Dead easy right? OK, this component isn't actually doing anything with the data, but this is only for demo purposes. Running this package (which I have attached to this blog entry) results in:

 

Note the two circled areas. Our output does indeed include a message correctly stating the number of processed rows.

That's a useful little trick that's worth remembering.

-Jamie

 

Published 03 July 2007 20:30 by jamie.thomson
Attachment(s): JT OutputtingRowsProcessed.zip

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Ben Harrell said:

Thanks for the post, can you do this with a custom source component?

July 3, 2007 23:30
 

jamie.thomson said:

Ben,

You can certainly call the method however I don't what results you'll have. Its supposed to be called from a destination component. the message says XXX wront Y rows. Source components don't write any rows, they put them into the pipeline.

-Jamie

July 4, 2007 01:07
 

Martin S said:

Yes you can certainly use it in a source component. Since you are probably reading something, you can set the first argument to the value 101. This indicates rows read.

e.g.

   Me.ComponentMetaData.IncrementPipelinePerfCounter(101,1)

Martin

September 23, 2007 22:30

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

Powered by Community Server (Personal Edition), by Telligent Systems