Percentage Sampling Transformation in SSIS with Example

327
11285

Friends,

Percentage Sampling transformation is similar to the TOP keyword in Sql Server. Just like TOP in SQL, Percentage Sampling Limits the records that are gonna flow through pipeline by the given integer as Percentage. Let’s say I have 1000 records in my source table and if I connect the same source to PERCENTAGE SAMPLING transformation by providing Limit records values to 10 then 10% of total records will be flowed from the transformation. Let us see an example of the same.

  • Open a new project and drag a Data Flow task from toolbox in Control Flow.
  • Edit the Data Flow task by double clicking the object or by selecting EDIT button on Right click on the object.
  • Make sure the Data Flow Page is opened as shown below.

  • Select OLE DB data source from data flow sources and drag and drop it in the data flow.
  • Double click on the OLE DB data source to open a new window where we can set the properties of the connection.
  • Select the connection manager and click on new button to set the connection string as shown below.

  • Set the connection to the database by providing the Server name,database name and authentication details if required.
  • After the connection is set, select Data Access mode as “Table or View” as shown below and then select the table which we are gonna use as input to PERCENTAGE SAMPLING Transformation.

  • Now select the columns that needs to be present as part of source by going to Columns Page in OLE DB Data Source as shown below.

  • Now drag and drop Percentage Sampling transformation and connect OLE DB source output as input to this transformation as shown below.

  • Now edit the Percentage sampling transformation and select PERCENTAGE of rows out of total records in the Source table you wants to use as sample by mentioning  it “Percentage of rows”.
  • Give some meaningful names to Sample Output and Unselected output and use “Use the following random seed” option to get Random values from the source rather than getting TOP records.

  • These are all the properties we can set for Percentage Sampling transformation. Now lets create couple of destinations to store Sampled output and not sampled output. I have taken OLE DB destination to push Sampled output and Flat File destination to push non sampled output.
  • Now drag the output of Percentage Sampling transformation to give source to OLE DB destination and it will prompt us to select the INPUT (we have two, one sampled and another one not sampled) and select Sampled output as shown below.

  • Select the Non Sampled output to Flat file destination and set the connection settings for both OLE DB and Flat File destinations. (You can see configuring destinations in the post here)
  • Now the package is ready to execute and do the same. Make sure all the items turn GREEN.

  • You can observe the records from source got grouped into two different pipelines based on the percentage we have given.

This is it !! This is one of the simplest transformation(to configure) available in SSIS and useful when ever you wish to limit the records flowing to destination.

Happy Coding !!

Regards,

Roopesh Babu V

327 COMMENTS

  1. [url=https://zithromaxforsale.shop/#]buy zithromax online fast shipping[/url] zithromax z-pak

  2. [url=https://stromectoltrust.com/#]stromectol 12 mg tablets[/url] stromectol 3 mg tablets price

  3. writing a masters dissertation
    [url=”https://bestdissertationwritingservice.net”]uk dissertation writing[/url]
    masters dissertation writing services uk

  4. writing dissertation methodology
    [url=”https://customdissertationwritinghelp.com”]writing methodology for dissertation[/url]
    dissertation consulting

  5. [url=https://canadiandrugs.best/#]amoxicillin without a doctor’s prescription[/url] ed meds online without doctor prescription

  6. what is a dissertation
    [url=”https://customthesiswritingservices.com”]writing a literature review for a dissertation[/url]
    uk dissertation writing

  7. medical dissertation writing services
    [url=”https://dissertationhelpspecialist.com”]dissertation completion pathway[/url]
    dissertation writing tips

  8. dissertation writing support
    [url=”https://professionaldissertationwriting.com”]medical dissertation writing service[/url]
    premium dissertation writing service

  9. [url=https://canadiandrugs.best/#]pet meds without vet prescription canada[/url] online prescription for ed meds

  10. dissertation help methodology
    [url=”https://writing-a-dissertation.net”]writing a dissertation literature review[/url]
    dissertation abstracts international

  11. format for writing dissertation proposals
    [url=”https://writingadissertationproposal.com”]phd without dissertation[/url]
    18 month doctorate without dissertation

  12. [url=https://drugsbestprice.com/#]prescription drugs without prior prescription[/url] errectile dysfunction

  13. [url=https://medrxfast.com/#]buy prescription drugs from canada cheap[/url] legal to buy prescription drugs from canada

  14. dating dominant gay men
    [url=”https://gay-singles-dating.com”]i have no gay friends cuz everyone sees me as a potential dating partner[/url]
    gay dating sex

  15. [url=https://amoxicillin.pro/#]amoxicillin 500mg buy online uk[/url] amoxicillin 500mg without prescription

  16. Doxycycline also has been shown to have delayed anti- malarial activity, which is a similar pathogen to Oodinium Ich found in our aquarium pond fish. doxycycline hyclate std Furthermore, we found no evidence of an increased SCV risk when exposed to ADHD medications, said the authors.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

29 + = 37