Hi, i am trying to parse an XML using OPENXML in a SQL server procedure.
The Xml was created by the DataSet.WriteXml command in .Net.
Here is the XML and the Stored procedure
<?xml version="1.0" standalone="yes"?>
<BidData xmlns="http://tempuri.org/BidData.xsd">
<Bid>
<UserID>1</UserID>
<TagNumber>1234</TagNumber>
<ImpersonatingUserID>1</ImpersonatingUserID>
<Description>Test-Sumit</Description>
<Status>1</Status>
<TrancheServiceTermId>2</TrancheServiceTermId>
</Bid>
<BidFormFieldData>
<BidFormFieldID>1</BidFormFieldID>
<BidFormFieldValue>1234</BidFormFieldValue>
</BidFormFieldData>
<BidFormFieldData>
<BidFormFieldID>2</BidFormFieldID>
<BidFormFieldValue>4567</BidFormFieldValue>
</BidFormFieldData>
</BidData>
----------------------------------------------------------------------------
---------
CREATE PROCEDURE dbo.sp_XmlTest
(@InputXml Text,
@BidId INTEGER OUTPUT)
AS
DECLARE @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@InputXml
SELECT @BidId=UserID
FROM OPENXML (@hDoc,'/BidData/Bid',2)
WITH (UserID numeric(18,0))
EXEC sp_xml_removedocument @hDoc
GO
----------------------------------------------------------------------------
------------------------------------
the problem i am having is that the XPATH does not find the UserID element
if my XML has the namespace attribute but works fine without it
(xmlns="http://tempuri.org/BidData.xsd"). Can you let me know what am i
missing here ?