Santosh
Santosh

Reputation: 101

How to get source file rowcount in data flow task SSIS?

I have a data flow task which contain excel file as the source and script component as the destination.

Is there a way to get the number of rows in my excel file and pass it my script component?

I already tried with Row count component but its value gets updated only after the data flow task is done.

Upvotes: 4

Views: 3270

Answers (2)

Hadi
Hadi

Reputation: 37368

if you want to use Row Count component you have to create two dataflow tasks:

  • the first only contains Excel Source + Row Count component
  • the second contains Excel Source + Derived Column + Destination

The derived column is used to add the variable that store the row count as a new column

More info in this question Does variable value set by Row Count Transformation take effect during execution of DFT in SSIS? or Conditional Split can read a variable correctly?

Upvotes: 1

Tab Alleman
Tab Alleman

Reputation: 31795

You can use a script task before the dataflow that counts the rows in the Excel file and stores it in a variable.

Upvotes: 0

Related Questions