Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL: Loading XML into a table::

Posted on 2013-06-25
3
Medium Priority
?
279 Views
Last Modified: 2013-07-03
hello team,

A third party of ours offered us a download method for an XML file.
Here is the issue; they are giving us the table in pagination. Meaning, page 1, 2, etc

I suppose, I can loop through x number of pages but don't know how to put them into ONE table and of course ONE xml in sql server 2008
Any assistance is appreciated
0
Comment
Question by:John Esraelo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
Mark Wills earned 1000 total points
ID: 39277620
Ummm... Not sure what you mean, or asking for, so will need a bit more explanation.

Are you saying that there are multiple XML files that you want to combine into a single table, or, a single XML file ?

Is it possible to give us an example (changing some labels and obfuscating sensitive data) and what you hope to achieve as a result ?

Sometimes, you might have to first load into a temporary staging area as a transition stage before putting away into your final destination.
0
 

Author Comment

by:John Esraelo
ID: 39278303
It is supposed to be a single table with 10,000 appx records (see URL, softwares.xml).  The keeper of the data does not want to allow users to download the whole table to avoid overload. Therefore, the so called API of theirs is allowing the users to specify a page number.  
http://www.samanage.com/api/index.html
I suppose I can loop thru the X number of pages, insert them as an xml record in a sql table.
At that point I am not sure how to combine all pages together.
0
 
LVL 51

Expert Comment

by:Mark Wills
ID: 39298606
Sorry about that... Didn't get back to you in a timely manner...

The hard bit is knowing how many pages. By the looks of things you can specify how many entries per page, not sure if there is a maximum, so would be interesting to first manually explore the maximum.

It does say that every request will give you the number of entries, the number of pages, etc. as part of the header block. While the example says "tickets" the example results seems to be "hardwares".

So, as a strategy I would write an SQL script to get the first 1 entry, examine that for total number of entries, then loop through grabbing a page at a time (saving as a disk file, use the -o param if using curl), specifying the number of entries per page, import that file into a staging table (a temp table would work), then once all pages have been loaded (or no more results), go through the staging table and then put away.  

Not sure why or when you need to combine the pages, assuming what you really want is the resulting nodes.

I would be breaking up the XML into discrete fields / columns based on the nodes of interest to you. You can always recreate an XML document based on those columns depending on what you ultimately want to do (and what format you need).
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question