The
following file is available for download from the Microsoft Download
Center:
Release Date:
10-19-2001
For additional information about how to download Microsoft
Support files, click the following article number to view the article in the
Microsoft Knowledge Base:
119591�
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
The OpenXML.exe file contains the following files:
Collapse this tableExpand this table
File name | Size |
---|
EULA.txt | 2 KB |
OpenXML.cpp | 6 KB |
XMLDoc.xml | 1 KB |
OpenXML.exe is a SQL Server 2000 extension to
Transact-SQL that allows stored procedures to process XML and generate rowsets
from the data for use by Transact-SQL statements. In this sample, an ADO client
passes an XML document to a stored procedure. The stored procedure runs a
SELECT statement, which generates a rowset. This rowset is then returned to the
client as an ADO
Recordset.
This sample creates a stored procedure named
SP_OpenXML_Example on a SQL Server 2000 database and passes an XML document
XMLDoc.xml to the stored procedure. The stored procedure processes the document
using OpenXML and returns an ADO
Recordset back to the client.
Additionally, the
SP_OpenXML_Example stored procedure contains calls into the system stored procedures
sp_xml_preparedocument and
sp_xml_removedocument that load and unload the document from memory respectively. The
SP_OpenXML_Example stored procedure is doing the following things:
- Runs the sp_xml_preparedocument system stored procedure to prepare the XML document for use by
Transact-SQL statements.
- Uses the OpenXML-generated rowset in a query.
- Runs sp_xml_removedocument to remove the prepared XML document from memory.
For more details about the
sp_xml_preparedocument and
sp_xml_removedocument stored procedures or about OpenXML, refer to SQL Server 2000
Books OnLine.
Steps to Run the Sample
- Create an empty Win32 console application.
- Insert OpenXML.cpp into the project.
- From the Project menu, click Settings, and then click the C/C++ tab. In the Project Options dialog box, change /MLd to /MTd.
- Copy XMLDoc.xml into the project folder.
- Compile and then run the application.