Re: How to select an attribute value from an XML-column using XPath/XQuery?
- From: Martin Honnen <mahotrash@xxxxxxxx>
- Date: Tue, 24 Apr 2007 13:23:34 +0200
Robert Pettersson wrote:
I think that I should be able to do that by running this query:
Select
Parameters.value('/Parameters/Parameter[@Name="@SystemUserID"]/@Value', 'int') As SystemUserIDValue
From
MyTable
But all I get is this error message:
Msg 2389, Level 16, State 1, Line 6
XQuery [MyDB.dbo.MyTable.Parameters.value()]: 'value()' requires a singleton (or empty sequence), found operand of type 'xdt:untypedAtomic *'
Make sure the XPath selects a single node by using e.g.
(/Parameters/Parameter[@Name="@SystemUserID"]/@Value)[1]
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.
- References:
- How to select an attribute value from an XML-column using XPath/XQuery?
- From: Robert Pettersson
- How to select an attribute value from an XML-column using XPath/XQuery?
- Prev by Date: How to select an attribute value from an XML-column using XPath/XQuery?
- Next by Date: Re: How to select an attribute value from an XML-column using XPath/XQuery?
- Previous by thread: How to select an attribute value from an XML-column using XPath/XQuery?
- Next by thread: Re: How to select an attribute value from an XML-column using XPath/XQuery?
- Index(es):
Relevant Pages
|