Solved

XML to MS SQL Server

Posted on 2002-07-12
4
191 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
[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 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

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