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

x
?
Solved

XML to MS SQL Server

Posted on 2002-07-12
4
Medium Priority
?
194 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 400 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 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