{"id":8207,"date":"2019-10-19T08:22:53","date_gmt":"2019-10-19T08:22:53","guid":{"rendered":"https:\/\/zappysys.com\/blog\/?p=8207"},"modified":"2019-11-18T14:44:14","modified_gmt":"2019-11-18T14:44:14","slug":"pivot-csv-data-ssis","status":"publish","type":"post","link":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/","title":{"rendered":"How to Pivot CSV Data in SSIS"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3102 size-full alignleft\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png\" alt=\"\" width=\"100\" height=\"100\" \/><\/a>In our previous blog we saw <a href=\"https:\/\/zappysys.com\/blog\/write-data-csv-file-ssis-gzip-split\/\" target=\"_blank\" rel=\"noopener\">How to write data into CSV file in SSIS (GZip \/ Split)<\/a>. Now in this blog, we will see <strong>How to Pivot CSV Data in SSIS using <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-csv-file-source-flat-file-web-api\/\" target=\"_blank\" rel=\"noopener\">CSV Source<\/a><\/strong>. It also supports Pivot mode so you can convert single CSV string value into Rows. In this article we also see how make some CSV columns as parent and not consider it in pivot and load it as it is using <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-json-generator-transform\/\" target=\"_blank\" rel=\"noopener\">JSON Generator<\/a> and <a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/ssis-json-parser-transform\/\" target=\"_blank\" rel=\"noopener\">JSON Parser\u00a0Transform<\/a> Pivot Option.<\/p>\n<p>In nutshell,\u00a0this post will focus on how to Pivot CSV Data into multiple columns and rows.<\/p>\n<p>&nbsp;<\/p>\n<div class=\"content_block\" id=\"custom_post_widget-2523\"><h2><span id=\"Prerequisites\">Prerequisites<\/span><\/h2>\r\nBefore we perform the steps listed in this article, you will need to make sure the following prerequisites are met:\r\n<ol style=\"margin-left: 1.5em;\">\r\n \t<li><abbr title=\"SQL Server Integration Services\">SSIS<\/abbr> designer installed.\u00a0Sometimes it is referred to as <abbr title=\"Business Intelligence Development Studio\">BIDS<\/abbr> or <abbr title=\"SQL Server Data Tools\">SSDT<\/abbr> (<a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/ssdt\/download-sql-server-data-tools-ssdt\" target=\"_blank\" rel=\"noopener\">download it from the Microsoft site<\/a>).<\/li>\r\n \t<li>Basic knowledge of SSIS package\u00a0development using\u00a0<em>Microsoft SQL Server Integration Services<\/em>.<\/li>\r\n \t<li>Make sure\u00a0<span style=\"text-decoration: underline;\"><a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\" target=\"_blank\" rel=\"noopener\">ZappySys SSIS PowerPack<\/a><\/span>\u00a0is installed (<a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/download\/\" target=\"_blank\" rel=\"noopener\">download it<\/a>, if you haven't already).<\/li>\r\n \t<li>(<em>Optional step<\/em>)<em>.<\/em>\u00a0<a href=\"https:\/\/zappysys.zendesk.com\/hc\/en-us\/articles\/360035974593\" target=\"_blank\" rel=\"noopener\">Read this article<\/a>, if you are planning to deploy packages to a server and schedule their execution later.<\/li>\r\n<\/ol><\/div>\n<h2>How to Pivot CSV Data in SSIS using CSV File Source<\/h2>\n<p>Let\u00b4s start with an example. In this SSIS CSV Parser Transform example, we will Parse database column string into multiple columns and rows.<\/p>\n<ol>\n<li>First\u00a0of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.\n<div id=\"attachment_7934\" style=\"width: 470px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7934\" class=\"wp-image-7934 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task.png\" alt=\"Drag and Drop SSIS Data Flow Task from SSIS Toolbox\" width=\"460\" height=\"155\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task.png 460w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task-300x101.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/a><p id=\"caption-attachment-7934\" class=\"wp-caption-text\">Drag and Drop : SSIS Data Flow Task from SSIS Toolbox<\/p><\/div><\/li>\n<li>Furthermore, drag and drop the CSV Source and Double click on it to configure it.\n<div id=\"attachment_8212\" style=\"width: 701px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8212\" class=\"wp-image-8212 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source.png\" alt=\"Drag and Drop : CSV Source from SSIS Toolbox\" width=\"691\" height=\"357\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source.png 691w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source-300x155.png 300w\" sizes=\"(max-width: 691px) 100vw, 691px\" \/><\/a><p id=\"caption-attachment-8212\" class=\"wp-caption-text\">Drag and Drop : CSV Source from SSIS Toolbox<\/p><\/div><\/li>\n<li>Enter the CSV file path and select desire column delimiter most common in CSV is comma and check the First Row as headers and click on preview.\n<div id=\"attachment_8213\" style=\"width: 683px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8213\" class=\"wp-image-8213 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview.png\" alt=\"CSV Source Preview\" width=\"673\" height=\"735\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview.png 673w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview-275x300.png 275w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/a><p id=\"caption-attachment-8213\" class=\"wp-caption-text\">CSV Source Preview<\/p><\/div><\/li>\n<li>Now, go to Pivot Columns to Rows Tab and checked Enable Pivoting and click on Preview Data to view the data.\n<div id=\"attachment_8214\" style=\"width: 730px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-pivot-preview.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8214\" class=\"wp-image-8214 size-medium_large\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-pivot-preview-768x643.png\" alt=\"CSV Source Pivoted Data Preview\" width=\"720\" height=\"603\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-pivot-preview-768x643.png 768w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-pivot-preview-300x251.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-pivot-preview.png 874w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><p id=\"caption-attachment-8214\" class=\"wp-caption-text\">CSV Source Pivoted Data Preview<\/p><\/div><\/li>\n<li>That&#8217;s it we see how to read data from CSV File and also Pivot the CSV Data using CSV Source.<\/li>\n<li>Now In the next section we will see how to\u00a0how make some CSV columns as parent and not consider it in pivot and load it as it is.<\/li>\n<\/ol>\n<h2>How make some CSV columns as parent.<\/h2>\n<p>Sometimes you just need to make child columns in to rows and want to leave parent level columns as it is.<\/p>\n<ol>\n<li>First\u00a0of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.\n<div id=\"attachment_7934\" style=\"width: 470px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7934\" class=\"wp-image-7934 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task.png\" alt=\"Drag and Drop SSIS Data Flow Task from SSIS Toolbox\" width=\"460\" height=\"155\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task.png 460w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/09\/ssis-drag-drop-data-flow-task-300x101.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/a><p id=\"caption-attachment-7934\" class=\"wp-caption-text\">Drag and Drop : SSIS Data Flow Task from SSIS Toolbox<\/p><\/div><\/li>\n<li>Secondly, drag and drop the CSV Source and Double click on it to configure it.\n<div id=\"attachment_8212\" style=\"width: 701px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8212\" class=\"wp-image-8212 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source.png\" alt=\"Drag and Drop : CSV Source from SSIS Toolbox\" width=\"691\" height=\"357\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source.png 691w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-drag-drop-csv-source-300x155.png 300w\" sizes=\"(max-width: 691px) 100vw, 691px\" \/><\/a><p id=\"caption-attachment-8212\" class=\"wp-caption-text\">Drag and Drop : CSV Source from SSIS Toolbox<\/p><\/div><\/li>\n<li>Furthermore, enter the file path and click on preview.\n<div id=\"attachment_8213\" style=\"width: 683px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8213\" class=\"wp-image-8213 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview.png\" alt=\"CSV Source Preview\" width=\"673\" height=\"735\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview.png 673w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-source-preview-275x300.png 275w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/a><p id=\"caption-attachment-8213\" class=\"wp-caption-text\">CSV Source Preview<\/p><\/div><\/li>\n<li>For example if we want to pivot Email and Phone only in pivoting and wants to exclude parent level columns FirstName and LastName as it is.<\/li>\n<li>For that drag and drop JSON Generator Transform and Select Output Mode as <strong>Output One JSON Per Parent Input Row<\/strong>\u00a0 and Add Unbound Nested Element and named it as <strong>Persons and click on OK<\/strong>.\n<div id=\"attachment_8277\" style=\"width: 638px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8277\" class=\"wp-image-8277 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element.png\" alt=\"JSON Generator Add Unbound Nested Element\" width=\"628\" height=\"624\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element.png 628w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element-150x150.png 150w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element-300x298.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/a><p id=\"caption-attachment-8277\" class=\"wp-caption-text\">JSON Generator Add Unbound Nested Element<\/p><\/div><\/li>\n<li>Now add that two parent level fields FirstName and LastName in the Persons.\n<div id=\"attachment_8278\" style=\"width: 746px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8278\" class=\"wp-image-8278 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple.png\" alt=\"JSON Generator Add Multiple Elements\" width=\"736\" height=\"623\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple.png 736w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple-300x254.png 300w\" sizes=\"(max-width: 736px) 100vw, 736px\" \/><\/a><p id=\"caption-attachment-8278\" class=\"wp-caption-text\">JSON Generator Add Multiple Elements<\/p><\/div><\/li>\n<li>Now select Person Element and right click and Add Unbound Nested Element and <strong>named it as Contacts and click on OK<\/strong>.\n<div id=\"attachment_8279\" style=\"width: 746px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element-in-attribute.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8279\" class=\"wp-image-8279 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element-in-attribute.png\" alt=\"JSON Generator Add Unbound Nested Element\" width=\"736\" height=\"623\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element-in-attribute.png 736w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-unbound-nested-element-in-attribute-300x254.png 300w\" sizes=\"(max-width: 736px) 100vw, 736px\" \/><\/a><p id=\"caption-attachment-8279\" class=\"wp-caption-text\">JSON Generator Add Unbound Nested Element<\/p><\/div><\/li>\n<li>Now add that two child level fields Email and Phone in the Contacts.\n<div id=\"attachment_8280\" style=\"width: 746px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple-attributes-2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8280\" class=\"wp-image-8280 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple-attributes-2.png\" alt=\"JSON Generator Add Multiple Elements\" width=\"736\" height=\"623\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple-attributes-2.png 736w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-add-multiple-attributes-2-300x254.png 300w\" sizes=\"(max-width: 736px) 100vw, 736px\" \/><\/a><p id=\"caption-attachment-8280\" class=\"wp-caption-text\">JSON Generator Add Multiple Elements<\/p><\/div><\/li>\n<li>Therefore JSON Generator Transform looks like below screen. Now Copy that Sample Preview JSON String to use it in the JSON Parser Transom as sample string.\n<div id=\"attachment_8276\" style=\"width: 743px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-sample-data.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8276\" class=\"wp-image-8276 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-sample-data.png\" alt=\"JSON Generator Transform - Sample Data\" width=\"733\" height=\"833\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-sample-data.png 733w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-generator-sample-data-264x300.png 264w\" sizes=\"(max-width: 733px) 100vw, 733px\" \/><\/a><p id=\"caption-attachment-8276\" class=\"wp-caption-text\">JSON Generator Transform &#8211; Sample Data<\/p><\/div><\/li>\n<li>Similarly, drag and drop JSON Parser Transform and select the Input JSON Column and Paste that copied Sample JSON String and select the Contacts filter to read the Child data and click on Include Parent.\n<div id=\"attachment_8281\" style=\"width: 853px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-select-filter.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8281\" class=\"wp-image-8281 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-select-filter.png\" alt=\"JSON Parser Transform - Select Filter \" width=\"843\" height=\"650\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-select-filter.png 843w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-select-filter-300x231.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-select-filter-768x592.png 768w\" sizes=\"(max-width: 843px) 100vw, 843px\" \/><\/a><p id=\"caption-attachment-8281\" class=\"wp-caption-text\">JSON Parser Transform &#8211; Select Filter<\/p><\/div><\/li>\n<li>Now go to Pivot Columns to Rows Tab and checked the Enable Pivoting and click on the Preview.\n<div id=\"attachment_8282\" style=\"width: 608px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-enable-pivoting.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8282\" class=\"wp-image-8282 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-enable-pivoting.png\" alt=\"JSON Parser Transform - Enable Pivoting\" width=\"598\" height=\"656\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-enable-pivoting.png 598w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-json-parser-enable-pivoting-273x300.png 273w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/><\/a><p id=\"caption-attachment-8282\" class=\"wp-caption-text\">JSON Parser Transform &#8211; Enable Pivoting<\/p><\/div><\/li>\n<li>Finally, we are ready to load this data.\n<div id=\"attachment_8283\" style=\"width: 887px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-pivot-data-viewer.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8283\" class=\"wp-image-8283 size-full\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-pivot-data-viewer.png\" alt=\"CSV Pivoted Data\" width=\"877\" height=\"388\" srcset=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-pivot-data-viewer.png 877w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-pivot-data-viewer-300x133.png 300w, https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2019\/10\/ssis-csv-pivot-data-viewer-768x340.png 768w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/a><p id=\"caption-attachment-8283\" class=\"wp-caption-text\">CSV Pivoted Data<\/p><\/div><\/li>\n<li>Let&#8217;s load this data in the SQL Server.<\/li>\n<\/ol>\n<h2><span id=\"Load_Walmart_API_data_into_SQL_Server\">Load Pivoted CSV File data into SQL Server<\/span><\/h2>\n<div class=\"content_block\" id=\"custom_post_widget-5617\"><p>ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other  targets. The <strong>Upsert Destination<\/strong> component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.<\/p>\r\n<h3>Step 1: Add Upsert Destination to Data Flow<\/h3>\r\n<ol>\r\n<li>Drag and drop the <strong>Upsert Destination<\/strong> component from the SSIS Toolbox.<\/li>\r\n<li>Connect your source component (e.g., JSON \/ REST \/ Other Source) to the Upsert Destination.<\/li>\r\n<\/ol>\r\n<div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/08\/ssis-data-flow-drag-drop-upsert-destination.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2017\/08\/ssis-data-flow-drag-drop-upsert-destination.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">SSIS - Data Flow - Drang and Drop Upsert Destination Component<\/p>\r\n<\/div>\r\n<h3>Step 2: Configure Target Connection<\/h3>\r\n<ol>\r\n<li>Double-click the <strong>Upsert Destination<\/strong> component to open the configuration window.<\/li>\r\n<li>Under <strong>Connection<\/strong>, select an existing target connection or click <strong>NEW<\/strong> to create a new connection.\r\n<ul>\r\n<li>Example: SQL Server, or PostgreSQL, or Amazon Redshift.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ol>\r\n<h3>Step 3: Select or Create Target Table<\/h3>\r\n<ol>\r\n<li>In the <strong>Target Table<\/strong> dropdown, select the table where you want to load data.<\/li>\r\n<li>Optionally, click <strong>NEW<\/strong> to create a new table based on the source columns.<\/li>\r\n<\/ol>\r\n<div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-configuration.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-configuration.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">Configure SSIS Upsert Destination Connection - Loading data (REST \/ SOAP \/ JSON \/ XML \/CSV) into SQL Server or other target using SSIS<\/p>\r\n<\/div>\r\n<h3>Step 4: Map Columns<\/h3>\r\n<ol>\r\n<li>Go to the <strong>Mappings<\/strong> tab.<\/li>\r\n<li>Click <strong>Auto Map<\/strong> to map source columns to target columns by name.<\/li>\r\n<li>Ensure you <strong>check the Primary key column(s)<\/strong> that will determine whether a record is inserted or updated.<\/li>\r\n<li>You can manually adjust the mappings if necessary.<\/li>\r\n<\/ol>\r\n <div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-key.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2020\/09\/upsert-destination-key.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">SSIS Upsert Destination - Columns Mappings<\/p>\r\n<\/div>\r\n<h3>Step 5: Save Settings<\/h3>\r\n<ul>\r\n<li>Click <strong>OK<\/strong> to save the Upsert Destination configuration.<\/li>\r\n<\/ul>\r\n<h3>Step 6: Optional: Add Logging or Analysis<\/h3>\r\n<ul>\r\n<li>You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.<\/li>\r\n<\/ul>\r\n<h3>Step 7: Execute the Package<\/h3>\r\n<ul>\r\n<li>Run your SSIS package and verify that the data is correctly inserted and updated in the target table.<\/li>\r\n<\/ul>\r\n<div class=\"wp-caption aligncenter\">\r\n<a href=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/12\/ssis-upsert-destination-execute.png\">\r\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full\" alt=\"\" src=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/12\/ssis-upsert-destination-execute.png\" \/><\/a>\r\n<p class=\"wp-caption-text\">SSIS Upsert Destination Execution<\/p>\r\n<\/div><\/div>\n<h2><span id=\"Conclusion\">Conclusion<\/span><\/h2>\n<p>After all, we saw you how to read CSV file data, pivot the data and Similarly, using SSIS JSON Generator and Parser Transform Pivot the CSV Data excluding some columns from pivoting.\u00a0 To explore many other scenarios not discussed in this article download\u00a0<a href=\"https:\/\/zappysys.com\/products\/ssis-powerpack\/\">SSIS PowerPack from here (includes 70+ Components)<\/a>.<\/p>\n<h2><span id=\"References\">References<\/span><\/h2>\n<p>Finally, you can use the following URL for more information.<\/p>\n<ul>\n<li>Help File:\u00a0<a href=\"https:\/\/zappysys.com\/onlinehelp\/ssis-powerpack\/index.htm#page=ssis-csv-source.htm\" target=\"_blank\" rel=\"noopener\">CSV Source<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In our previous blog we saw How to write data into CSV file in SSIS (GZip \/ Split). Now in this blog, we will see How to Pivot CSV Data in SSIS using CSV Source. It also supports Pivot mode so you can convert single CSV string value into Rows. In this article we [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":3102,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[447,131,136,1],"tags":[128,6,12],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>How to Pivot CSV Data in SSIS | ZappySys Blog<\/title>\r\n<meta name=\"description\" content=\"How to Pivot CSV Data in SSIS\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to Pivot CSV Data in SSIS | ZappySys Blog\" \/>\r\n<meta property=\"og:description\" content=\"How to Pivot CSV Data in SSIS\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/\" \/>\r\n<meta property=\"og:site_name\" content=\"ZappySys Blog\" \/>\r\n<meta property=\"article:published_time\" content=\"2019-10-19T08:22:53+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2019-11-18T14:44:14+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"100\" \/>\r\n\t<meta property=\"og:image:height\" content=\"100\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"ZappySys\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ZappySys\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/\",\"url\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/\",\"name\":\"How to Pivot CSV Data in SSIS | ZappySys Blog\",\"isPartOf\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png\",\"datePublished\":\"2019-10-19T08:22:53+00:00\",\"dateModified\":\"2019-11-18T14:44:14+00:00\",\"author\":{\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35\"},\"description\":\"How to Pivot CSV Data in SSIS\",\"breadcrumb\":{\"@id\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#primaryimage\",\"url\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png\",\"contentUrl\":\"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png\",\"width\":100,\"height\":100},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/zappysys.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Pivot CSV Data in SSIS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/zappysys.com\/blog\/#website\",\"url\":\"https:\/\/zappysys.com\/blog\/\",\"name\":\"ZappySys Blog\",\"description\":\"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/zappysys.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35\",\"name\":\"ZappySys\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g\",\"caption\":\"ZappySys\"},\"url\":\"https:\/\/zappysys.com\/blog\/author\/hshah\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Pivot CSV Data in SSIS | ZappySys Blog","description":"How to Pivot CSV Data in SSIS","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/","og_locale":"en_US","og_type":"article","og_title":"How to Pivot CSV Data in SSIS | ZappySys Blog","og_description":"How to Pivot CSV Data in SSIS","og_url":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/","og_site_name":"ZappySys Blog","article_published_time":"2019-10-19T08:22:53+00:00","article_modified_time":"2019-11-18T14:44:14+00:00","og_image":[{"width":100,"height":100,"url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png","type":"image\/png"}],"author":"ZappySys","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ZappySys","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/","url":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/","name":"How to Pivot CSV Data in SSIS | ZappySys Blog","isPartOf":{"@id":"https:\/\/zappysys.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#primaryimage"},"image":{"@id":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#primaryimage"},"thumbnailUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png","datePublished":"2019-10-19T08:22:53+00:00","dateModified":"2019-11-18T14:44:14+00:00","author":{"@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35"},"description":"How to Pivot CSV Data in SSIS","breadcrumb":{"@id":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#primaryimage","url":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png","contentUrl":"https:\/\/zappysys.com\/blog\/wp-content\/uploads\/2018\/02\/ssis-csv-file-source.png","width":100,"height":100},{"@type":"BreadcrumbList","@id":"https:\/\/zappysys.com\/blog\/pivot-csv-data-ssis\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/zappysys.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Pivot CSV Data in SSIS"}]},{"@type":"WebSite","@id":"https:\/\/zappysys.com\/blog\/#website","url":"https:\/\/zappysys.com\/blog\/","name":"ZappySys Blog","description":"SSIS \/ ODBC Drivers \/ API Connectors for JSON, XML, Azure, Amazon AWS, Salesforce, MongoDB and more","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/zappysys.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/c9dc782c929d0027e2e87e3951ce9d35","name":"ZappySys","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/zappysys.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/076a738938c19d459fbfe125c759a0ea?s=96&d=mm&r=g","caption":"ZappySys"},"url":"https:\/\/zappysys.com\/blog\/author\/hshah\/"}]}},"_links":{"self":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/8207"}],"collection":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/comments?post=8207"}],"version-history":[{"count":15,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/8207\/revisions"}],"predecessor-version":[{"id":8342,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/posts\/8207\/revisions\/8342"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media\/3102"}],"wp:attachment":[{"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/media?parent=8207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/categories?post=8207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zappysys.com\/blog\/wp-json\/wp\/v2\/tags?post=8207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}