Solved

XML to MS SQL Server

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SUM 2 INTEGER ARRAYS INTO 1 10 108
Problem to With line 4 64
firemonkey Android Listview Sort items 7 55
adding "ungroup sheets" to existing vbs code 5 33
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
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…

820 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