How to automatically import XML file into various new tables using SSIS



I have a very large XML file (with an xsd file) which has many different objects that need to be imported into SQL Server tables. When I mean objects, I mean the highest level XML wrapping tag e.g. Products, Orders, Locations etc


My current method using SSIS has been to:



  1. Create a Data Flow Task

  2. Set up a new XML source in the data flow task

  3. Drag a new OLE DB Destination into the task

  4. Link the XML output to the input of the OLE DB Destination

  5. Open the OLE DB Destination task and ask it to create a new table for the data to go into


I have to repeat steps 3-5 for all the objects in the XML file which could run into the hundreds. Theres no way that I can manually do this.


Is there anyway to get SSIS to just create new tables for all the different objects in SQL server and import the data into those? So it would automatically create dbo.Products, dbo.Locations, dbo.Customers and put the correct XML data into those tables.


I can't see any other feasible way of doing this.


No comments:

Post a Comment