{"id":25036,"date":"2023-04-03T05:36:00","date_gmt":"2023-04-03T03:36:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=25036"},"modified":"2023-05-17T12:11:43","modified_gmt":"2023-05-17T10:11:43","slug":"export-sql-server-data-to-xml-with-ssis","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/","title":{"rendered":"Export SQL Server data into an XML file with SSIS"},"content":{"rendered":"\n<h4 class=\"wp-block-heading has-text-align-center\" id=\"h-export-data-from-a-sql-server-table-into-an-xml-document-with-an-ssis-package\"><strong><em>Export data from a SQL Server table into an XML document with an SSIS package.<\/em><\/strong><\/h4>\n\n\n\n<p>To export a SQL Server table to an XML file type with an SSIS package and without any additional components, you need to transform the SQL data to XML using a query. SSIS does not provide a native XML component, only an XML source exists. Other software editors offer components for exporting to XML, such as the SSIS productivity pack from KingswaySoft, for example.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/#1-create-the-sql-server-table-with-data-to-export-in-xml\" >1. Create the SQL Server table with data to export in XML<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/#2-build-the-query-to-transform-sql-data-into-xml\" >2. Build the query to transform SQL data into XML<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/#3-configure-the-ssis-flow-from-the-sql-source-table-to-the-xml-file\" >3. Configure the SSIS flow from the SQL source table to the XML file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/#4-configure-the-xml-file-to-be-exported-from-ssis\" >4. Configure the XML file to be exported from SSIS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/#5-run-the-package-to-export-the-table-to-xml-and-check-the-content\" >5. Run the package to export the table to XML and check the content<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-create-the-sql-server-table-with-data-to-export-in-xml\"><span class=\"ez-toc-section\" id=\"1-create-the-sql-server-table-with-data-to-export-in-xml\"><\/span>1. Create the SQL Server table with data to export in XML<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The first step of course is to create a sample source table in SSMS to have some data. Use the following code to create the customer table and insert 8 rows to export in XML format.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- Cr\u00e9er la table des clients\nCREATE TABLE [dbo].[Customers](\n   [CustomerID] [int] NOT NULL,\n   [FirstName] [nvarchar](20) NULL,\n   [LastName] [nvarchar](20) NULL,\n   [City] [nvarchar](20) NULL,\n   [Country] [nvarchar](50) NULL,\n   CONSTRAINT [CustomersPrimaryKeyCustomerID] PRIMARY KEY CLUSTERED ([CustomerID] ASC)\n);\nGO\n\n-- Ins\u00e9rer 8 lignes \u00e0 exporter au format XML\nINSERT INTO [dbo].[Customers] VALUES (1, N'Ali', N'Ahmed', N'Cairo', N'Egypt');\nINSERT INTO [dbo].[Customers] VALUES (2, N'Johnny', N'John', N'Toronto', N'Canada');\nINSERT INTO [dbo].[Customers] VALUES (3, N'John', N'Doe', N'Mexico City', N'Mexico');\nINSERT INTO [dbo].[Customers] VALUES (4, N'Shu', N'Abbas', N'Paris', N'France');\nINSERT INTO [dbo].[Customers] VALUES (5, N'Jeane', N'Raffin', N'Liushutun', N'China');\nINSERT INTO [dbo].[Customers] VALUES (6, N'Legra', N'Leate', N'B\u0142aszki', N'Poland');\nINSERT INTO [dbo].[Customers] VALUES (7, N'Sullivan', N'Goadby', N'Xiaoguwei', N'China');\nINSERT INTO [dbo].[Customers] VALUES (8, N'Tom', N'Ellams', N'Lop Buri', N'Thailand');<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2-build-the-query-to-transform-sql-data-into-xml\"><\/span>2. Build the query to transform SQL data into XML<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>After creating the table and inserting customer data, build the SQL Server query to transform SQL data into XML.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- SQL Select query to check the Customers data\nSELECT\n   [CustomerID],\n   [FirstName],\n   [LastName],\n   [City],\n   [Country]\nFROM [dbo].[Customers];\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-1-check-source-data-ssms.jpg\" alt=\"Use SSMS to check and export SQL Server data into an XML file with SSIS\" class=\"wp-image-12870\" width=\"600\" height=\"540\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-1-check-source-data-ssms.jpg 600w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-1-check-source-data-ssms-300x270.jpg 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption class=\"wp-element-caption\"><em>Use SSMS to check and export SQL Server data into an XML file with SSIS<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Now, here is the query with the XML functions to create the XML elements Customers and Customer.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">-- XML Query to transform the data into XML format and allow the export\nSELECT \n   [CustomerID],\n   [FirstName],\n   [LastName],\n   [City],\n   [Country]   \nFROM [dbo].[Customers]\nFOR XML PATH('Customer'),\n      ROOT('Customers'),\n         ELEMENTS XSINIL;<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"460\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-2-build-xml-query.jpg\" alt=\"Edit and run the XML SQL query to transform the rows into XML format\" class=\"wp-image-12876\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-2-build-xml-query.jpg 600w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-2-build-xml-query-300x230.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-2-build-xml-query-80x60.jpg 80w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption class=\"wp-element-caption\"><em>Edit and run the XML SQL query to transform the rows into XML format<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Click on the link in the result to display the XML file in a new SSMS window.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"380\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-3-raw-xml-result.jpg\" alt=\"Customer table in XML format displayed in the SSMS tab\" class=\"wp-image-12881\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-3-raw-xml-result.jpg 720w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-3-raw-xml-result-300x158.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><figcaption class=\"wp-element-caption\"><em>Customer table in XML format displayed in the SSMS tab<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>The data returned by the XML query is of IMAGE type, meaning it is a file. To transform the SQL Server IMAGE type into text, include the query as a subquery. The column is also renamed to <em>XML_Column<\/em> <a href=\"https:\/\/expert-only.com\/en\/ssis\/create-a-simple-ssis-data-flow\/\">to facilitate mapping from the SSIS data flow<\/a>. Use a subquery to encapsulate the previous one and display the result as text in a SQL column.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT (\n   SELECT \n       [CustomerID],\n       [FirstName],\n       [LastName],\n       [City],\n       [Country]   \n   FROM [dbo].[Customers]\n   FOR XML PATH('Customer'),\n         ROOT('Customers'),\n            ELEMENTS XSINIL\n) AS XML_Column;\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"440\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-4-xml-to-column-ssms.jpg\" alt=\"XML query in a subquery executed in SSMS to display the result as text\" class=\"wp-image-12888\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-4-xml-to-column-ssms.jpg 680w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-4-xml-to-column-ssms-300x194.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-4-xml-to-column-ssms-678x440.jpg 678w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><figcaption class=\"wp-element-caption\"><em>XML query in a subquery executed in SSMS to display the result as text<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3-configure-the-ssis-flow-from-the-sql-source-table-to-the-xml-file\"><\/span>3. Configure the SSIS flow from the SQL source table to the XML file<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Add the SSIS OLE DB Source and the Flat File Destination components in the data flow.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"580\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-5-add-ole-db-and-flat-file.jpg\" alt=\"SSIS data flow to export SQL Server data into an XML file with SSIS\" class=\"wp-image-12898\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-5-add-ole-db-and-flat-file.jpg 660w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-5-add-ole-db-and-flat-file-300x264.jpg 300w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><figcaption class=\"wp-element-caption\"><em>SSIS data flow to export SQL Server data into an XML file with SSIS<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Open the OLE DB Source component and <a href=\"https:\/\/expert-only.com\/en\/ssis\/how-to-connect-to-sql-server-with-ssis\/\">use a connection to the source database<\/a>. Enter the query from the previous step using a simple copy \/ paste in the SSIS OLE DB Source Editor.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-6-add-sql-query-ole-db.jpg\" alt=\"Insert the source query to return the column in XML format\" class=\"wp-image-12903\" width=\"660\" height=\"680\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-6-add-sql-query-ole-db.jpg 660w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-6-add-sql-query-ole-db-291x300.jpg 291w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><figcaption class=\"wp-element-caption\"><em>Insert the source query to return the column in XML format<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>If you change the query, <strong>check that the data type is DT_NTEXT<\/strong>, i.e. in Unicode Text format, to avoid errors when mapping to the file. To do so, right-click and choose <em>Show Advanced Edito<\/em>r.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"816\" height=\"879\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-7-advanced-editor-xml-column-dt_ntext.jpg\" alt=\"Check the format of the XML column to export as a document\" class=\"wp-image-12910\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-7-advanced-editor-xml-column-dt_ntext.jpg 816w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-7-advanced-editor-xml-column-dt_ntext-278x300.jpg 278w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-7-advanced-editor-xml-column-dt_ntext-768x827.jpg 768w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><figcaption class=\"wp-element-caption\"><em>Check the format of the XML column to export as a document<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4-configure-the-xml-file-to-be-exported-from-ssis\"><\/span>4. Configure the XML file to be exported from SSIS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>From the file component, open the <em>Flat File Destination Editor<\/em> Window and create a new flat file connection. Choose the <strong><em>Delimited<\/em><\/strong> type.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"820\" height=\"780\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-8-new-flat-file.jpg\" alt=\"Create a new flat file connection to export the XML file\" class=\"wp-image-12919\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-8-new-flat-file.jpg 820w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-8-new-flat-file-300x285.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-8-new-flat-file-768x731.jpg 768w\" sizes=\"auto, (max-width: 820px) 100vw, 820px\" \/><figcaption class=\"wp-element-caption\"><em>Create a new flat file connection to export the XML file<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>To set up the file, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Rename the XML file: <strong>XML File Export<\/strong><\/li>\n\n\n\n<li>Choose the path on the disk, in our case it is: <strong>C:\\data\\Customers_Data_Export.xml<\/strong><\/li>\n\n\n\n<li>Select <strong>Unicode<\/strong> to ensure the mapping with the source column.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"714\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-9-set-up-xml-file.jpg\" alt=\"Configure the options for the target XML file to be exported\" class=\"wp-image-12928\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-9-set-up-xml-file.jpg 729w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-9-set-up-xml-file-300x294.jpg 300w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><figcaption class=\"wp-element-caption\"><em>Configure the options for the target XML file to be exported<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>By default, Integration Services uses the <em>DT_WSTR type with a length of 255 characters<\/em>. Now set the XML column to adapt it to the column we export. <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>From the <strong>Advanced<\/strong> tab<\/li>\n\n\n\n<li>Rename the column with the same name as the source: <strong>XML_Column<\/strong><\/li>\n\n\n\n<li>Change the data type to Unicode text: <strong>Unicode text stream [DT_NTEXT]<\/strong><\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"775\" height=\"745\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-10-change-xml-column-dt_ntext.jpg\" alt=\"Rename the column and change the type to Unicode text stream DT_NTEXT\" class=\"wp-image-12938\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-10-change-xml-column-dt_ntext.jpg 775w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-10-change-xml-column-dt_ntext-300x288.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-10-change-xml-column-dt_ntext-768x738.jpg 768w\" sizes=\"auto, (max-width: 775px) 100vw, 775px\" \/><figcaption class=\"wp-element-caption\"><em>Rename the column and change the type to Unicode text stream DT_NTEXT<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Also check the mapping of the column from the <em>Mappings<\/em> tab.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"440\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-11-check-xml-file-mapping.jpg\" alt=\"Mapping from the SQL Server source table to the XML file to export with SSIS\" class=\"wp-image-12945\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-11-check-xml-file-mapping.jpg 600w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-11-check-xml-file-mapping-300x220.jpg 300w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-11-check-xml-file-mapping-80x60.jpg 80w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption class=\"wp-element-caption\"><em>Mapping from the SQL Server source table to the XML file to export with SSIS<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5-run-the-package-to-export-the-table-to-xml-and-check-the-content\"><\/span>5. Run the package to export the table to XML and check the content<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Finally, run the package to actually export the data from the SQL Server source table into the XML document, i.e. a file with the XML format. Only one row is transferred because the column contains the entire file in XML format and not the classic rows in SQL format.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-12-execute-xml-file-export.jpg\" alt=\"Run the SSIS package and Export SQL Server data into an XML file with Visual Studio\" class=\"wp-image-12952\" width=\"720\" height=\"580\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-12-execute-xml-file-export.jpg 720w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-12-execute-xml-file-export-300x242.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><figcaption class=\"wp-element-caption\"><em>Run the SSIS package and Export SQL Server data into an XML file with Visual Studio<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>Then check the exported file, i.e. from <strong>C:\\data\\Customers_Data_Export.xml<\/strong>.<\/p>\n\n\n\n<p>Open the file with <a href=\"https:\/\/www.google.fr\/chrome\/\" target=\"_blank\" rel=\"noreferrer noopener\">Google Chrome<\/a> or another open source web browser like <a href=\"https:\/\/www.mozilla.org\/en-US\/firefox\/new\/\" target=\"_blank\" rel=\"noreferrer noopener\">Mozilla Firefox<\/a> for example. And finally check the data and the structure of the file.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"540\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-13-check-xml-export-file-chrome.jpg\" alt=\"Open the XML file with Google Chrome to display the structure\" class=\"wp-image-12966\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-13-check-xml-export-file-chrome.jpg 680w, https:\/\/expert-only.com\/wp-content\/uploads\/2022\/10\/ssis-export-table-to-xml-13-check-xml-export-file-chrome-300x238.jpg 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><figcaption class=\"wp-element-caption\"><em>Open the XML file with Google Chrome to display the structure<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">Conclusion on exporting data into an XML document with SSIS<\/h3>\n\n\n\n<p>To conclude, the process to export SQL Server data into an XML file with SSIS is not completely guided, as SSIS does not provide a native component for XML export. However, with T-SQL code and available components, it is possible to adapt the query to the data structure and configure the components with the appropriate data type.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Useful resources on data export with SSIS or Python<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-data-in-csv-with-ssis\/\"><strong>Export SQL Server data into a text file with SSIS<\/strong><\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-excel\/\"><strong>SSIS package to export a SQL table to an Excel file<\/strong><\/a><\/li>\n\n\n\n<li><strong><a href=\"https:\/\/expert-only.com\/en\/python\/export-sql-server-data-to-csv-in-python\/\">Use Python to export SQL Server data into a CSV file<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Export data from a SQL Server table into an XML document with an SSIS package. To export a SQL Server table to an XML file type with an SSIS package and without any additional components, you need to transform <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/ssis\/export-sql-server-data-to-xml-with-ssis\/\" title=\"Export SQL Server data into an XML file with SSIS\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10654,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[516],"tags":[],"class_list":{"0":"post-25036","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ssis"},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/25036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=25036"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/25036\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10654"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=25036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=25036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=25036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}