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

Reading Data From XML through Script component Expand / Collapse
Author
Message
Posted Thursday, February 14, 2013 4:27 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 3:04 PM
Points: 162, Visits: 570
Goal : Need to pull data from XML file (800MB).

Note: I tried to do with XML task and XSLT but couldn't make it work, it gives me an Out of Memory expection error.

http://beyondrelational.com/modules/2/blogs/106/posts/11130/ssis-read-xml-file-in-script-component-as-source.aspx

I end up searching above link.

Issues : I can't get this to work either. My script task complaints me when I try to AddRow() function, (Please go throw the link if you can understand C# )
Script complaints "doesnot contain definition and no extension method can be found (are you missing a using directive or an assembly reference?)"

Help need: Plz suggest me a solution to read data frm XML either through new process or Please guide me to help out of this error thrown while writing C# script (in the link above).
Post #1420340
Posted Friday, February 15, 2013 2:12 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:28 AM
Points: 5,030, Visits: 11,763
quillis131 (2/14/2013)
Goal : Need to pull data from XML file (800MB).

Note: I tried to do with XML task and XSLT but couldn't make it work, it gives me an Out of Memory expection error.

http://beyondrelational.com/modules/2/blogs/106/posts/11130/ssis-read-xml-file-in-script-component-as-source.aspx

I end up searching above link.

Issues : I can't get this to work either. My script task complaints me when I try to AddRow() function, (Please go throw the link if you can understand C# )
Script complaints "doesnot contain definition and no extension method can be found (are you missing a using directive or an assembly reference?)"

Help need: Plz suggest me a solution to read data frm XML either through new process or Please guide me to help out of this error thrown while writing C# script (in the link above).


I can understand C# and read the link, which presumably is a working solution.

I would guess that either:
a) The Script Component config has been set up wrongly, or
b) Your C# code has one or more syntax errors

but guesswork is as far as I can go without more info.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1420437
Posted Friday, February 15, 2013 2:28 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:08 PM
Points: 7,097, Visits: 12,599
800MB is an awfully large XML document. Note that when represented in memory as an XMLDocument object it will occupy far more space that just the file on disk. How much RAM is on the machine you are trying this on?

Try with a smaller version of the file with the same structure and see if you can get a proof-of-concept done.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1420772
Posted Friday, February 15, 2013 6:09 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 3:04 PM
Points: 162, Visits: 570
opc.three (2/15/2013)
800MB is an awfully large XML document. Note that when represented in memory as an XMLDocument object it will occupy far more space that just the file on disk. How much RAM is on the machine you are trying this on?

Try with a smaller version of the file with the same structure and see if you can get a proof-of-concept done.


I was able to load 200MB of file size through XSLT script in XML task. But Working with 800MB File size is an issue here.

Is there any better solution you can think of to load 800MB of XML file?
Post #1420837
Posted Friday, February 15, 2013 7:10 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:08 PM
Points: 7,097, Visits: 12,599
I think XMLReader is going to scale better because it dies not have to load the entire file into memory to work with it, but in using it you're signing up for some C# coding.

You could also look into SQLXML bulk load. I have used it successfully in the past but not for anything close to the size file you're dealing with, maybe 50MB tops iirc.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1420840
Posted Monday, February 18, 2013 10:20 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 3:04 PM
Points: 162, Visits: 570
opc.three (2/15/2013)
I think XMLReader is going to scale better because it dies not have to load the entire file into memory to work with it, but in using it you're signing up for some C# coding.

You could also look into SQLXML bulk load. I have used it successfully in the past but not for anything close to the size file you're dealing with, maybe 50MB tops iirc.



Can you spell out C# code with XML reader? I could make use of it plz
Post #1421290
Posted Monday, February 18, 2013 11:27 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:08 PM
Points: 7,097, Visits: 12,599
Use of XMLReader is an iterative approach so you'll be writing code with the structure "for each node in document, do something" and those for each statements can be nested. The actual code will depend on your XML structure. You'll find numerous samples of this online.

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

Add to briefcase

Permissions Expand / Collapse