469,148 Members | 1,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,148 developers. It's quick & easy.

XPATH in SQLServer 2000

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 ?
Jul 20 '05 #1
0 1438

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by K.Strunk | last post: by
4 posts views Thread by Gismo | last post: by
14 posts views Thread by Roy Gourgi | last post: by
2 posts views Thread by =?Utf-8?B?SmVmZnJleQ==?= | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.