Tuesday, August 18, 2015

Rowcount Transformation

Rowcount Transformation

- It is used to get the total number of records in last transformation or source.
- It puts the value into a variable which we can use further


EXAMPLE

Pre-requisite

Following script has to be executed

CREATE TABLE RowCountDemo (MID INT, MName VARCHAR(10))
CREATE TABLE RowCountDemoOutput (MID INT, MName VARCHAR(10),TotalRecords INT)

INSERT INTO RowCountDemo (MID,MName) VALUES (1,'Nisarg'),(5,'Megha'),(2,'Swara')


Steps

0. Create one variable saying TotalRecords of INT datatype
1. Add Data Flow Task in Control Flow
2. Drag source in DFT and it should point to RowCountDemo table
3. Drag Rowcount transformation and connect it with Source.

4. Make sure to choose created variable which will hold the value
5. Drag Derived Column Transformation and connect it with RowCount.

6. Drag destination and connect it with Derived Column. Have proper column mapping and execute the package and check the result int output table.