Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs

Row Count Transformation in SSIS

by suresh

The Row Count Transformation in SSIS used to counts the rows as they pass through a data flow and store the final count in a variable. For example, If we want to inform the Manager to notify the number of rows inserted, then we can use SSIS Row Count Transformation for counting the rows. Then use the Script Task to send an e-mail message to the Manager.

In SQL Server Integration Services, Row Count Transformation will not update the variable value until the last row of the source data has passed through this SSIS Transformation. So, we can’t use the updated values in the middle. Let us design one package so that we can understand this SSIS Row Count transformation better.

Row Count Transformation in SSIS Example

STEP 1: Drag and drop the data flow task from the toolbox to control flow and rename it as Row Count Transformation in SSIS

SSIS Row Count Transformation 1

STEP 2: This transformation stores counted rows information in a variable only, so before using this transformation, we need to create a variable on the Variables tab and add an integer variable to the package.

Right-click on the SSIS Control Flow region will open the context menu with multiple options. Select the Variables option from the context menu to create a variable.

SSIS Row Count Transformation 2

In this case, we’ve chosen to add a variable named NumberOfRows of integer type and assigned value to 0.

SSIS Row Count Transformation 3

Double click on the data flow task will open the data flow tab.

STEP 3: Drag and drop OLE DB Source, Row Count Transformation from the SSIS toolbox to the data flow region

SSIS Row Count Transformation 4

STEP 4: Double click on OLE DB source in the data flow region will open the connection manager settings and provides space to write our SQL statement.

SSIS Row Count Transformation 5

SQL Command we used in the above figure

USE AdventureWorksDW2014
GO

SELECT [EnglishCountryRegionName]
      ,[StateProvinceName]
      ,[City]
      ,[PostalCode]
      ,RESELLER.[UnitPrice]
      ,RESELLER.[ProductStandardCost]
      ,RESELLER.[TotalProductCost]
      ,RESELLER.[SalesAmount]
      ,RESELLER.[TaxAmt]
    
FROM [DimGeography]
  INNER JOIN [FactResellerSales] AS RESELLER ON
[DimGeography].[SalesTerritoryKey] = RESELLER.[SalesTerritoryKey] 
ORDER BY [EnglishCountryRegionName],[StateProvinceName]

STEP 5: Click on columns tab to verify the columns. In this tab we can uncheck the unwanted columns also.

SSIS Row Count Transformation 6

Click ok

STEP 6: The final step is to configure the Row Count transformation. Double click on the SSIS Row Count Transformation will open small Row Count Window to select the User-defined Variable from the drop-down. Here we are choosing the already created variable (NumberOfRows).

SSIS Row Count Transformation 7

Or you can configure the SSIS Row Count Transformation with a more traditional approach. Right-click on the Row Count Transformation will open the context menu with multiple options. Here select the Show Advanced Editor option from it.

SSIS Row Count Transformation 8

It opens the Advanced Editor of the SSIS Row Count Transformation. Within the Component Properties tab choose the VariableName property of the Row Count Editor, shown in Figure below and associate the variable we created before (NumberOfRows)

SSIS Row Count Transformation 9

STEP 7: Go to Control flow region and Drag and drop the Script Task from the toolbox to the Control Flow Region. Next, double-click on it to configure

SSIS Row Count Transformation 10

STEP 8: Select the user-defined variable as a read-write variable

SSIS Row Count Transformation 11

STEP 9: Click ok and then click on Edit Script button to open class file

SSIS Row Count Transformation 12

Type the following lines of code in the Main method

String Message = Dts.Variables["User::NumberOFRows"].Value.ToString();

MessageBox.Show(Message);
SSIS Row Count Transformation 13

NOTE: Here, I used the C# programming language code, and I am sorry for VB.Net people. I hope you can understand this code.

Close the class file, and Let’s run the SSIS Row Count Transformation package. From the below screenshot, you can observe that it is displaying the Message Box with the Number of Rows information.

SSIS Row Count Transformation 14

Let us see the data Flow region whether the SSIS Row Count transformation is giving the correct Result or not

SSIS Row Count Transformation 15

Remember, Until you click the ok button, Script task will be in running mode. Once you close the Message Box, then the Green Tick Mark will be shown

SSIS Row Count Transformation 16

You can observe the message box displaying the number of rows passed through that transformation.

NOTE: This SSIS Row Count transformation has one input and one output. It does not support an error output.

Placed Under: SSIS

  • What is SSIS
  • Install SQL Server Data Tools
  • Learn SSIS in 28 Days
  • Create a SSIS Project
  • Create SSIS Package
  • SSIS Connection Manager
  • OLE DB Connection Manager
  • SSIS ADO Connection Manager
  • ADO.NET Connection Manager
  • SSIS Cache Connection Manager
  • SSIS Excel Connection Manager
  • SSIS File Connection Manager
  • SSIS FTP Connection Manager
  • SSIS SMO Connection Manager
  • Source Assistance in SSIS
  • Flat File Source in SSIS
  • OLE DB Source in SSIS
  • Excel Source in SSIS
  • ADO.NET Source in SSIS
  • SSIS FLAT FILE Destination
  • SSIS OLE DB Destination
  • SSIS ADO.NET Destination
  • SSIS Transformations
  • SSIS Audit Transformation
  • SSIS Aggregate Transformation
  • SSIS Aggregate Advanced Mode
  • SSIS Cache Transformation
  • SSIS Character Map
  • SSIS Conditional Split
  • SSIS Copy Column
  • SSIS Data Conversion
  • SSIS Derived Column
  • SSIS Export Column
  • SSIS Fuzzy Grouping
  • SSIS Fuzzy Lookup
  • SSIS Import Column
  • SSIS Lookup Introduction
  • Lookup – OLE DB Connection
  • SSIS Lookup in Full Cache Mode
  • SSIS Lookup – Case Sensitivity
  • SSIS Merge Transformation
  • SSIS Merge Join Transformation
  • SSIS Merge Join – Left Outer Join
  • SSIS Merge – Right Outer Join
  • SSIS Merge Join – Full Outer Join
  • SSIS Multicast Transformation
  • SSIS OLEDB Command
  • OLEDB Command – Delete Data
  • OLEDB Command-Update Data
  • SSIS Percentage Sampling
  • SSIS Pivot Transformation 2008
  • SSIS Pivot Transformation
  • SSIS Row Count Transformation
  • SSIS Row Sampling
  • Script Component as Source
  • Script Component as Destination
  • SSIS Script as Transformation
  • SSIS Sort Transformation
  • SSIS SCD Type 0
  • SSIS SCD Type 1
  • SSIS SCD Type 2
  • SSIS Term Lookup
  • SSIS Term Extraction Intro
  • Term Extraction – Extract Nouns
  • SSIS Extract Noun Phrases
  • Extract Nouns & Noun Phrases
  • Term Extraction – Exclusion Tab
  • SSIS Unpivot Transformation
  • SSIS Union All Transformation
  • SSIS For Loop Container
  • SSIS ForEach File Enumerator
  • SSIS ForEach SMO Enumerator
  • SSIS ForEach Variable
  • SSIS Foreach NodeList
  • Foreach ADO.NET Schema Rowset Enumerator
  • SSIS Bulk Insert Task
  • SSIS Data Profiling Task
  • Execute T-SQL Statement Task
  • SSIS Execute SQL Task Intro
  • SSIS Execute SQL Task Example
  • Execute SQL Task- Single Rowset
  • Execute SQL Task – Full Row Set
  • SSIS Execute Package Task
  • Execute Packages in SQL Server
  • Execute Packages in File System
  • SSIS Execute Package Project Reference
  • SSIS File System Task
  • SSIS File System Task- Copy Files
  • File System Task-Copy Directory
  • File System Task – Delete Files
  • File System Task – Delete Folder
  • File System Task -Move Directory
  • SSIS File System Task -Move File
  • File System – Move Multiple files
  • File System Task – Rename File
  • File System Task – Set Attributes
  • SSIS FTP TASK
  • SSIS Create Local Directory
  • SSIS Create Remote Directory
  • SSIS FTP Task Send Files
  • SSIS FTP – Send Multiple Files
  • SSIS FTP Task Delete Local Files
  • FTP TASK Delete Local Directory
  • FTP Task Delete Remote files
  • SSIS Delete Remote Directory
  • SSIS FTP Task Receive Files
  • SSIS FTP Receive Multiple Files
  • SSIS Script Task
  • Transfer SQL Server Objects Task
  • Transfer SQL Table Structures
  • Transfer SQL Tables with Data
  • Transfer SQL Stored Procedures
  • Transfer User Defined Functions
  • Transfer SQL Views in SSIS
  • SSIS Web Service Task
  • SSIS XML Task-Validate XML File
  • Transform XML File using XSLT
  • XML Task-XML files Differences
  • Create SSIS Catalog
  • Package Deployment using BIDS
  • Deploy Package Using SQL
  • Deploy using SQL Server Wizard
  • SSIS Breakpoints
  • SSIS Checkpoints
  • SSIS Error Handling
  • SSIS Event Handlers
  • SSIS Transactions
  • SSIS Logging
  • SSIS Parameters
  • SSIS Package Configuration
  • Configure using SQL Server
  • Config using Registry Entry
  • Conf with Environment Variable
  • SSIS XML Configuration File
  • XML Configuration File Part 2
  • SSIS Package Protection Level
  • SSIS Incremental Load
  • Incremental Load Example 2
  • SSIS Remove Double Quotes
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy