Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 openxml

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2005-02-24 : 07:32:31
how to read data from xml file direct into a table ?

Noam Graizer

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-24 : 07:38:11
The easiest way is to use the SQLXML Bulk load utility:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/bulkload_7pv0.asp

Other ways to get XML from a file into the tables are somewhat tricky, Ken Henderson describes a method in his book

The Guru's Guide to SQL Server Stored Procedures, XML, and HTML
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2005-02-24 : 07:47:51
sorry but it is not say how to load a file ?

Noam Graizer
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-24 : 07:51:49
There's an example here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/bulkload_7pv0.asp

The left-hand window has related links with more information on how SQLXML bulk load works.
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2005-02-24 : 07:55:02
I need to load an xml file using store procedure.
is openXML the only way ?

Noam Graizer
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-02-24 : 08:08:09
Ken's book has a stored procedure that does it using OPENXML.

You can also call COM objects from SQL Server using sp_OACreate and the related sp_OA system procedures (see Books Online), so the bulk load examples on MSDN can be easily translated to work in a T-SQL stored procedure.
Go to Top of Page
   

- Advertisement -