Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Multiple outputs from XML Source Expand / Collapse
Author
Message
Posted Friday, January 11, 2013 11:26 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: 2 days ago @ 7:09 AM
Points: 21, Visits: 174
Hi,

I'm trying to load xml data into sql table using xml source, the file has around 6000 fileds. When i click on columns in XML source editor i see mutiple outputs each having set of available columns.Now when i connect source to destionation it asking me to select one output from above available outputs.Do we have any option to select all outputs at a time and load into destination? I have around 80 outputs like that.

First time i come across with this scenario,Can anyone please suggest on this?


Thanks,
Kumar
Post #1406209
Posted Friday, January 11, 2013 8:23 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, September 29, 2014 5:52 AM
Points: 369, Visits: 1,215
-- load file into xml variable
DECLARE @x xml
SELECT @x = CAST(c1 as xml)
FROM OPENROWSET(BULK 'D:\temp\sampledata.xml', SINGLE_CLOB) t1(c1)

--turn xml into table with nodes() function:
declare @xml as xml = '
<ArrayOfCustomers
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<Customer id="1">
<CustomerName>Mr Smith</CustomerName>
<Children>
<Child ChildName="Peter" />
<Child ChildName="Ivan" />
</Children>
</Customer>
<Customer id="2">
<CustomerName>Mr Bloggs</CustomerName>
<Children>
<Child ChildName="John" />
</Children>
</Customer>
</ArrayOfCustomers>
'
SELECT AOC.Cust.value('.','varchar(max)')
FROM @xml.nodes('/ArrayOfCustomers/Customer') AS AOC(Cust)


HTH,
Vedran


_____________________________________________________
Microsoft Certified Master: SQL Server 2008
XDetails Addin - for SQL Developers
blog.sqlxdetails.com - Transaction log myths
Post #1406304
Posted Saturday, January 12, 2013 10:34 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 8:51 PM
Points: 7,140, Visits: 12,763
If you have a complex XML file and SSIS detects 80 outputs then you'll have to process each of the 80 outputs in some form or manner if you want the data loaded somewhere. How do you suppose SSIS could process 80 outputs into one Destination if each output has a different set of fields or different data types?

Maybe you could look into the Bulk XML Loader built into SQLXML. With it you can provide a specialized xsd and the loader will automatically bring the XML into tables you define in the xsd.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1406450
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse