.NETGURU
Write XML file to a SQL 2000 database table
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngxml' list.


Bob Herrmann
I have not worked with XML much so this is probably a very dumb question. I have an XML file and a schema file that a customer has sent us. I want to read this XML file and dump it into our SQL Server 2000 database table. I cannot find a good example of this anywhere. Can someone show me some code on how to do this or show me a web site that has a good example?

Thanks,
Bob
Reply to this message...
 
    
Kirk Allen Evans
[Original message clipped]

Do you simply want to put the entire XML document as a string into a single
database column, is that correct? Or are you trying to parse the XML out
into separate columns? What is your platform? Are you using ASP to get the
XML, are you using ADO 2.6 to communicate with the database, or are you
using .NET? For ADO 2.6, see the AppendChunk method [1].

Dan Wahlin wrote several articles on parsing an XML document and inserting
its contents into SQL Server, you might want to browse his site at
XMLForASP.NET. One of his articles [2] is a great overview that might help
you as well.

You can use templates with SQL Server virtual directories, updategrams, SQL
Server's OPENXML clause, bulk load, or SQLXML, and I am sure that I am
leaving at least 1 technique out of the ever-growing list. You can use each
of these techniques using ADO.NET or ADO 2.6, but ADO.NET also throws in the
capability to read any XML document using a DataSet, which can be used with
a SqlCommand to insert the contents into SQL Server.

[1]
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthappchunk.asp?frame=t
rue
[2]
http://www.fawcette.com/xmlmag/2001_12/online/online_eprods/xml_dwhalin11_29
/

Kirk Allen Evans
http://www.xmlandasp.net
"XML and ASP.NET", New Riders Publishing
http://www.amazon.com/exec/obidos/ASIN/073571200X

Reply to this message...
 
    
El Mack
(Type your message here)
I saw this post and in my case, I'm trying to write the contents of an XML file to a SQL dB as a text BLOB. How do I write the XMLDoc or File to a string? At this point in the app, I've already created the XMLFile and would prefer to not have to recreate it and write to a stream. Is there someway can load it to say an XmlDocument and write it out as a string?

--------------------------------
From: El Mack
Reply to this message...
 
 
System.Data.DataSet
System.Data.SqlClient.SqlCommand
System.Xml.XmlDocument




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification