Groups | Blog | Home
all groups > asp.net building controls > august 2004 >

asp.net building controls : HELP!!HELP!! - Import XMl into SQl using ASp


Michael Persaud
8/17/2004 10:09:40 AM
HI,

I have a xml file and would like to import its contents into a table in
SQl2000

can some one say how? it has to insert multiple records


Thanks MP


Michael Rys [MSFT]
8/17/2004 10:27:54 AM
Look at the SQLXML 3.0 XML Bulkload functionality (if the file is large), or
pass the file to a SQL stored procedure and use OpenXML.

HTH
Michael

[quoted text, click to view]

Michael Persaud
8/17/2004 2:09:42 PM
Thanks....

I got it using the dataset object

works like a charm

MP

Graeme Malcolm
8/17/2004 6:26:50 PM
There are a number of options for doing this. The most likely candidates in
your case are probably:
1. Create an annotated schema and use the SQLXML Bulk Load component to
import the XML into tables in the database, or
2. Create a stored procedure in the database that uses the OPENXML function
to shred the XML: data into the appropriate tables. You'd then use ADO to
call the stored procedure (passing your XML data as a parameter).

Either of these approaches can be used to insert multiple records.

Your first step should be to download SQLXML 3.0 from
http://www.microsoft.com/downloads/details.aspx?familyid=4c8033a9-cf10-4e22-8004-477098a407ac&displaylang=en
and read the documentation on the Bulk Load component. SQL Server 2000 Books
Online includes documentation of the OPENXML function.

If you have any further questions, please post an example of the XML data
and the tables into which it needs to be inserted.

Hope that helps,
Graeme

--
----
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com


[quoted text, click to view]
HI,

I have a xml file and would like to import its contents into a table in
SQl2000

can some one say how? it has to insert multiple records


Thanks MP



AddThis Social Bookmark Button