471,853 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

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 1464

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
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.