{"id":12295,"date":"2016-12-07T12:26:00","date_gmt":"2016-12-07T12:26:00","guid":{"rendered":"https:\/\/viewmyprojects.com\/winwirewp\/?p=12295"},"modified":"2025-01-29T10:45:18","modified_gmt":"2025-01-29T10:45:18","slug":"data-tap-in-sql-server","status":"publish","type":"post","link":"https:\/\/viewmyprojects.com\/winwirewp\/blog\/data-tap-in-sql-server\/","title":{"rendered":"An Insight into Data Tap in SQL Server"},"content":{"rendered":"\n<p>Data taps are one of the great significant features in SQL Server in the Data analysis during runtime. In a nutshell, they enable us, at runtime, to choose a given path from a data flow and capture a copy of the data at that specific point of the data flow in a .csv file on a given execution instance of the package.<\/p>\n\n\n\n<p><em>Let\u2019s break it down further:<br><\/em><br><strong>Problem<\/strong><br>When we develop any SSIS package, to view the data passing through the pipeline we add Dataviewer, but once we deploy a package there was no built-in support for data tapping to analyze the data for troubleshooting. In SQL2012 and later versions this can be done using data taps.<\/p>\n\n\n\n<p><strong>What is a Data Tap?<br><\/strong>A Data Tap is an output of the data from one of the data flow paths in your package. Data Taps are like Data Viewers. The difference is that a Data Tap exports the data to a file from an already deployed package.<\/p>\n\n\n\n<p><strong>How to add a Data Tap?<br><\/strong>To get started, make sure you are using SQL Server 2012 or Later version and have deployed your package using the new Project Deployment Model.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"286\" height=\"128\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap.webp\" alt=\"\" class=\"wp-image-18744\"\/><\/figure><\/div>\n\n\n<p>After you deploy the package to the server, you need to execute T-SQL scripts against the SSISDB database to add data taps before executing the package.<\/p>\n\n\n\n<p>1. Create an execution instance of a package by using the catalog.create_execution (SSISDB Database) stored procedure.<br>2. Add a data tap by using either catalog.add_data_tap or catalog.add_data_tap_by_guid stored procedure.<br>3. Start the execution instance of the package by using the catalog.start_execution (SSISDB Database).<\/p>\n\n\n\n<p>Instead of typing the SQL statements, you can generate the execute package script by performing the following steps:<br>1. Right-click Package.dtsx and click Execute.<br>2. Click Script toolbar button to generate the script.<br>3. Now, add the add_data_tap statement before the start_execution call.<\/p>\n\n\n\n<p><strong><em>In our example following is the script generated<\/em><\/strong><\/p>\n\n\n\n<p>Declare @execution_id bigint<br>EXEC [SSISDB].[catalog].[create_execution] @package_name=N\u2019Package.dtsx\u2019,<br>@execution_id=@execution_id OUTPUT, @folder_name=N\u2019DataTap Example\u2019,<br>@project_name=N\u2019DataTap\u2019, @use32bitruntime=False, @reference_id=Null<br>Select @execution_id<br>DECLARE @var0 smallint = 1<\/p>\n\n\n\n<p>EXEC [SSISDB].[catalog].[set_execution_parameter_value] @execution_id, @object_type=50, @parameter_name=N\u2019LOGGING_LEVEL\u2019, @parameter_value=@var0<\/p>\n\n\n\n<p>EXEC [SSISDB].[catalog].[start_execution] @execution_id<br>GO<\/p>\n\n\n\n<p><strong>There are 2 options for adding the datatap.<\/strong><\/p>\n\n\n\n<p><strong>1. add_data_tap<\/strong><\/p>\n\n\n\n<p>To supply the values for all of the parameters, you\u2019ll need the package in design mode available to you. Here is the add_data_tap command we\u2019ll insert before the start_execution line.<\/p>\n\n\n\n<p>EXEC [SSISDB].[catalog].add_data_tap @execution_id = @execution_id,<br>@task_package_path = \u2018\\Package\\DFT_ExportCurrency\u2019,<br>@dataflow_path_id_string = \u2018Paths[OLE_SRC_Currency.OLE DB Source Output]\u2019,<br>@data_filename = \u2018output.txt\u2019<\/p>\n\n\n\n<p>@task_Pacakge_path is obtained from the DFT property name PackagePath.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"463\" height=\"123\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap1.png.webp\" alt=\"\" class=\"wp-image-18745\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap1.png.webp 463w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap1.png-300x80.webp 300w\" sizes=\"auto, (max-width: 463px) 100vw, 463px\" \/><\/figure><\/div>\n\n\n<p>@Dataflow_path_id_string value is obtained from the propertyname IdentificationString.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"238\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap2.png.webp\" alt=\"\" class=\"wp-image-18743\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap2.png.webp 480w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap2.png-300x149.webp 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/figure><\/div>\n\n\n<p>The datatap output file will get saved in the folder path \\Microsoft SQL Server\\110\\DTS\\DataDumps.<\/p>\n\n\n\n<p><strong>2. add_data_tap_by_guid<\/strong><\/p>\n\n\n\n<p>This function takes the task ID instead of the task package path. The command in my example is<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"458\" height=\"171\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap3.webp\" alt=\"\" class=\"wp-image-18742\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap3.webp 458w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/add-a-data-trap3-300x112.webp 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/figure><\/div>\n\n\n<p>EXEC [SSISDB].[catalog].add_data_tap_by_guid @execution_id = @execution_id,<br>@dataflow_task_guid = \u2018{0210C9CC-635B-4038-AFC4-54220909F4F3}\u2019,<br>@dataflow_path_id_string = \u2018Paths[OLE_SRC_Currency.OLE DB Source Output]\u2019,<br>@data_filename = \u2018output.txt\u2019<\/p>\n\n\n\n<p><strong>Listing all the Datataps<\/strong><\/p>\n\n\n\n<p>You can also list all the data taps by using the catalog.execution_data_taps view.<br>Select * from [SSISDB].[catalog].execution_data_taps where execution_id=@execid<\/p>\n\n\n\n<p><strong>Performance Consideration<\/strong><\/p>\n\n\n\n<p>Enabling verbose logging level and adding data taps increase the I\/O operations performed by your data integration solution. Hence, add data taps should be used only for troubleshooting purposes and when the data volume is less.<\/p>\n\n\n\n<p><strong>Conclusion:<\/strong><\/p>\n\n\n\n<p>Troubleshooting data issues can get hairy at times and data taps are an extra tool in our belt that can help in cases where logging (which has also improved a lot in SSIS 2012) and dumps may not give us the required level of information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data taps are one of the great significant features in SQL Server in the Data analysis during runtime. In a nutshell, they enable us, at runtime, to choose a given path from a data flow and capture a copy of the data at that specific point of the data flow in a .csv file on&hellip; <a class=\"more-link\" href=\"https:\/\/viewmyprojects.com\/winwirewp\/blog\/data-tap-in-sql-server\/\">Continue reading <span class=\"screen-reader-text\">An Insight into Data Tap in SQL Server<\/span><\/a><\/p>\n","protected":false},"author":82,"featured_media":16705,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_eb_attr":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-12295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","entry"],"acf":[],"featured_image_src":"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic.webp","author_info":{"display_name":"Thejaswini","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/thejaswini\/"},"views":3764,"uagb_featured_image_src":{"full":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic.webp",800,440,false],"thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic-150x150.webp",150,150,true],"medium":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic-300x165.webp",300,165,true],"medium_large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic-768x422.webp",750,412,true],"large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic.webp",750,413,false],"1536x1536":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic.webp",800,440,false],"2048x2048":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic.webp",800,440,false],"post-thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/An-Insight-into-Data-Tap-in-SQL-Server-graphic.webp",800,440,false]},"uagb_author_info":{"display_name":"Thejaswini","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/thejaswini\/"},"uagb_comment_info":0,"uagb_excerpt":"Data taps are one of the great significant features in SQL Server in the Data analysis during runtime. In a nutshell, they enable us, at runtime, to choose a given path from a data flow and capture a copy of the data at that specific point of the data flow in a .csv file on&hellip;&hellip;","_links":{"self":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/12295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/comments?post=12295"}],"version-history":[{"count":3,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/12295\/revisions"}],"predecessor-version":[{"id":22606,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/12295\/revisions\/22606"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media\/16705"}],"wp:attachment":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media?parent=12295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/categories?post=12295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/tags?post=12295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}