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)
 Using OPENXML to create a rowset

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-03 : 17:58:06
Larry A writes "
Can anyone help me with a SQL Server / XML question?

The following procedure is intended to accept a string parameter (@strXMLDoc) representing an XML document and store the contents to a newly created table. Instead, it creates an empty table.

I have tried setting the string value of @strXMLDoc within the procedure, and it works fine. When I pass the value in as a parameter, I get an empty table.

How can I pass the contents of @strXMLDoc in as a parameter?

Thanks in advance.

Larry A

**************

Alter Procedure cspInsertXMLDataTable
@strXMLDoc VarChar(8000) As

Declare @iXMLDoc Int
Exec sp_xml_preparedocument @iXMLDoc Output, @strXMLDoc
Select *
Into XMLDataTable
From OpenXML (@iXMLDoc, '/Root/Invoice',2)
With (InvNo VarChar(20), InvDate VarChar(20), Comment ntext '@mp:xmltext')
Exec sp_xml_removedocument @iXMLDoc

**************"
   

- Advertisement -