Row Sampling (Un-Selected Output) Transformationin SSIS


Introduction:

In this article we are going to see how to use a Row Sampling transformation in SSIS Packaging. Row sampling is used to randomly select some rows and move them as output to the required process, as and when required, to divide the rows. An example of using this transformation is say for example if we want to randomly select some 10 users of a community for a random prize then we can use this transformation. In this process we are going to see an example of how to use this process for the unselected output values. Let's jump start to see this sample of how to set the properties of the control.
To follow my series of articles on SSIS, go through my profile.

Steps:

Follow steps 1 to 3 on my first article to open the BIDS project and select the right project to work on an integration services project. Once the project is created, we will see how to use the Percentage sampling to see the flow. Now once the project has been opened drag and drop a source and a Percentage sampling task as shown in the screen below:


Now we can see the red mark on the control which indicates that the controls are not yet configured. Now let us configure the source (refer to my previous articles on how to configure an OLEDB source). Now your output will look like before.

SSIS1.gif

Now we need to configure the Row Sampling task; double-click the task to open the screen as below:

SSIS3.gif

Here we can specify the number of random rows to be selected and the name for the Sample output selected and unselected. Since in our example we are going to see the Unselected Output we will see how to use it. Now after specifying the number of rows just click on the OK button. Now drag and drop the Flat File Destination as shown in the following screen:

SSIS3.gif

Now drag the green line from the Row Sampling to the Flat File destination task. It will open a window as shown in the following screen:

SSIS4.gif

Here we have selected the Unselected output as the Output to get the data as we can see in the screen above. Now click on OK to do the further configuration of the destination as shown in the following screen:

SSIS5.gif

Once the configuration is done we can see the screen as below:

SSIS7.gif

Now our package is ready to execute. Press F5 and execute the project; we can see the screen as below which indicates that the package is executed successfully.

SSIS8.gif

We can see that only 81 rows are randomly selected and passed to the destination. Which means that out of the 10 selected rows the remaining 81 rows which are not selected have been processed. We can see the output by opening the file which we gave in the destination configuration section. You can see the result as shown in the screen below:

SSIS9.gif

Conclusion:

So in this article we have seen how to use Row Sampling (Unselected Output) to execute a dataset and split based on the number of rows and use it as required.


Similar Articles