Solved

XML to MS SQL Server

Posted on 2002-07-12
4
178 Views
Last Modified: 2013-11-23
Hi,
    I am using Visual Basic 6.0 and I have incoming XML documents that I want placing in a database. Currently the database is on MS SQL Server, though I may need to change this at a later date.
    I can think of plenty of ways of importing the XML into a database, but I'd like to ask if anyone has an efficient way of doing this.
   
    The current method I'm using is turning XML into an SQL Queries. This means that the query can now be made on any database. I can use either XSL or an object library (currently using XSL) to convert the XML to SQL Queries.
    And then connecting to the MS SQL Server and executing the query.

    Thanks
0
Comment
Question by:DragonWolf
4 Comments
 
LVL 1

Author Comment

by:DragonWolf
ID: 7149197
I'm using the MSXML library using the DOM data structure and DOM transformation to implement the XSL on the XML.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7149384
If all you want to do is save the XML document in SQL Server than all you need is to write a Stored Procedure and pass the XML document as a parameter or use the Stream object.

Anthony
0
 
LVL 18

Accepted Solution

by:
mdougan earned 100 total points
ID: 7150218
If you are using SQL Server 2000 there are a number of efficient alternatives.  The most efficient one I think would be using the new bulk load feature that is available with the Web Release 1 of SQL Server (see the second link below).  There are also queries that you can construct using OpenXML for either selecting data or inserting/updating data (you can also update using the Web Release 1 through "updategrams")

OpenXML
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsql/ac_openxml_1cx8.asp

Web Release 1
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/updategrams.asp

A less efficient approach, depending on the format of your XML, is that you could probably load it into a disconnected recordset using the Recordset.Load (or is that Recordset.Read?) command, and providing the XML file (or DOM Object).  Then, you might be able set an active connection and do an .UpdateBatch
0
 
LVL 5

Expert Comment

by:jayeshshah
ID: 7151216
i think the best way is to open a recordset using the XMl file & then execute the insert into statement to insert in the SQL Server.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now