Solved

Read xml file and insert into database table

Posted on 2008-10-20
8
1,495 Views
Last Modified: 2008-11-08
I have an xml file containing multiple records that I need to insert into a SQL2000 database table called Images. I would like to know the best way to do this when their could be a hundred records of data in the XML file.

The xml is formatted as follows:
<?xml version='1.0' encoding='utf-8'?>
<Picture>
  <PictureName></PictureName>
  <WorkOrderNo></WorkOrderNo>
  <IssueNo></IssueNo>
  <Round></Round>
  <Operative></Operative>
  <InChargeDate></InChargeDate>
  <LocationNo></LocationNo>
  <PanelNo></PanelNo>
  <WorkDate></WorkDate>
  <WorkTime></WorkTime>
  <Design></Design>
  <GPSLattitude></GPSLattitude>
  <GPSLongitude></GPSLongitude>
  <MOMSFeedback></MOMSFeedback>
</Picture>
<Picture>
  <PictureName></PictureName>
  <WorkOrderNo></WorkOrderNo>
  <IssueNo></IssueNo>
  <Round></Round>
  <Operative></Operative>
  <InChargeDate></InChargeDate>
  <LocationNo></LocationNo>
  <PanelNo></PanelNo>
  <WorkDate></WorkDate>
  <WorkTime></WorkTime>
  <Design></Design>
  <GPSLattitude></GPSLattitude>
  <GPSLongitude></GPSLongitude>
  <MOMSFeedback></MOMSFeedback>
</Picture>

Open in new window

0
Comment
Question by:clearchannel
[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
  • 4
  • 4
8 Comments
 
LVL 1

Expert Comment

by:patricka_0377
ID: 22756666
I have used OpenXML for this in a stored procedure setting the input xml as a TEXT parameter

Create an internal representation of the document using sp_xml_preparedocument (@INT_DOC OUTPUT, @XML_DOC)
0
 

Author Comment

by:clearchannel
ID: 22756737
I just want to use ASP and VBScript for this task, no SPs.
0
 
LVL 1

Expert Comment

by:patricka_0377
ID: 22756970
i would like to see a solution just using these techs too.... but I will wait and see for responses
...
if the only tool you have is a hammer every problem is a nail
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:clearchannel
ID: 22758022
I am not saying only those technologies, but I would predominantly like to read the xml file contents, loop through the items insert them into a database table using asp, vbscript, an xml parser or reader and sql.
No SPs. No need for the sarcastic comments.
0
 
LVL 1

Expert Comment

by:patricka_0377
ID: 22758213
no sarcasm intended... I just thought it was difficult to do limiting to certain technologies... and was looking forward to see what people came up with.
0
 
LVL 1

Expert Comment

by:patricka_0377
ID: 22758263
Why no SP? I don't understand why you would not want to use these?

The architecture of a solution is something I always take great interest in as it can commonly cause massive problems at later stages if not done properly in the first instance.
0
 

Author Comment

by:clearchannel
ID: 22865604
Because I would rather not use them. I have found a solution elsewhere now.
0
 

Accepted Solution

by:
clearchannel earned 0 total points
ID: 22867573
I have used LINQ 2 SQL and the ReadXML method, creating a dataset for the data import
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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