I am using SSIS in Visual Studio 2008. I have many XML files that I need to process and place into an existing DB structure (SQL Server 2005). This is my first attempt at using SSIS and am a little stuck. I have found the XML Data Flow task, assigned it a test xml file and it's associated XSD, and mapped one node to a Database Table. My question is, how do I associate many xsd nodes with many tables? Surely I don't have to set up an XML source for each table?
相关问题
- sql execution latency when assign to a variable
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
- SQL to Parse a Key-Value String
相关文章
- Entity Framework 4.3.1 failing to create (/open) a
- Code for inserting data into SQL Server database u
- SSIS solution on GIT?
- Delete Every Alternate Row in SQL
- Linux based PHP install connecting to MsSQL Server
- SQL Azure Reset autoincrement
- How do we alias a Sql Server instance name used in
- Is recursion good in SQL Server?
Here is a possible option which demonstrates how to load multiple XML files having same definition into an SQL Server table. The example uses
SQL Server 2008 R2
andSSIS 2008 R2
. The example shown here loads three XML files into an SQL table using SSISData Flow Task
with the help ofXML Source
component.Step-by-step process:
dbo.Items
using the script given under SQL Scripts section.Items.xsd
in the folder path C:\temp\xsd using the content provided under XSD File section.Items_1.xml
,Items_2.xml
andItems_3.xml
in the folder path C:\temp\xml using the content provided under XML Files section.FileExtension
,FilePath
andFolderPath
as shown in screenshot #1.SQLServer
to connect to the SQL Server Instance as shown in screenshot #2.Control Flow
tab, place aForeach loop container
and aData Flow Task
within the Foreach loop container as shown in screenshot #3.Foreach Loop container
as shown in screenshots #4 and #5.Data Flow Task
to navigate to theData Flow
tab. Place anXML Source
component and anOLE DB Destination
as shown in screenshot #6.XML Source
as shown in screenshot #7 and #8. The XML file path will be retrieved from the variable FilePath. This variable will be populated by theForeach Loop container
.OLE DB Destination
as shown in screenshots #9 and #10.dbo.Items
now contains the data present in three XML files.Hope that helps.
SQL Scripts:
XSD File
XML Files
Items_1.xml
Items_2.xml
Items_3.xml
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
Screenshot #5:
Screenshot #6:
Screenshot #7:
Screenshot #8:
Screenshot #9:
Screenshot #10:
Screenshot #11:
Screenshot #12:
Screenshot #13:
Screenshot #14:
You also need to add
@[user::FilePath]
to the[XML Source].[XMLData]
in the data flow task or the package says no source file found after package execution.