Home > Archive > MS SQL XML > October 2006 > SQL Error message 2260 , etc









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQL Error message 2260 , etc
a

2006-10-24, 6:49 pm


Get the following error when running the XQuery code below (no namespace
declared here...)

Msg 2260, Level 16, State 1, Line 35
XQuery & #91;SEC_Daily_Index_
01.FormXML.value()]: There is no element named
'ownershipDocument'


SELECT
DateFiled,

SUM(
FormXML.value('
sum(
for $n in
(/ownershipDocument/nonDerivativeTable/ nonDerivativeTransac
tion/transactionAmounts)
where ($n/ transactionAcquiredD
isposedCode/value) = "A"
return
($n/ transactionPricePerS
hare/value)[1] *
($n/transactionShares/value)[1]
)
','float')
)
AS nonDerivativeTransac
tionValueA

I tried declaring a namespace like this:

SELECT
DateFiled,

SUM(
FormXML.value('
sum(
declare namespace xmlns:t="http://iSemantex.com/ ownership4Document_M
2";
for $n in
(/t:ownershipDocument/ t:nonDerivativeTable
/ t:nonDerivativeTrans
action/ t:transactionAmounts
)
where ($n/ t:transactionAcquire
dDisposedCode/t:value) = "A"
return
($n/ t:transactionPricePe
rShare/t:value)[1] *
($n/t:transactionShares/t:value)[1]
)
','float')
)
AS nonDerivativeTransac
tionValueA

but then I get this error...
Msg 2217, Level 16, State 1, Line 35
XQuery & #91;SEC_Daily_Index_
01.FormXML.value()]: ',' or ')' expected


The xml starts like this:
<ownershipDocument xmlns="http://iSemantex.com/ ownership4Document_M
2">
<schemaVersion>X0202</schemaVersion>
<documentType>4</documentType>
<periodOfReport>2006-08-01Z</periodOfReport>

and the Schema (in the schema collection) starts like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://iSemantex.com/ ownership4Document_M
2"
targetNamespace="http://iSemantex.com/ ownership4Document_M
2"
elementFormDefault="qualified">
<xsd:element name="ownershipDocument">
<xsd:complexType>

Frodo, what does it all mean? ;-)

What shall I do to make this stuff work?

Thanks,

Paul
Kent Tegels

2006-10-24, 6:49 pm

Hello Paul,

I believe this is simply a matter of declaring the namespace in the wrong
location. In Xquery, the namespace should be declared as part of the prologue,
like this:

declare @x xml
set @x = '<ownershipDocument xmlns="http://iSemantex.com/ ownership4Document_M
2">
<schemaVersion>X0202</schemaVersion>
<documentType>4</documentType>
<periodOfReport>2006-08-01Z</periodOfReport>
</ownershipDocument>'
select @x.query('declare default element namespace "http://iSemantex.com/ ownership4Document_M
2";
//documentType')

Looks to me like you've tried to declare it within the sum function.

Thanks,
Kent Tegels
http://staff.develop.com/ktegels/


a

2006-10-24, 6:49 pm

Thanks Kent...as you pointed out, that was my error.

Paul

-------------------------------------------------------

"Kent Tegels" wrote:

> Hello Paul,
>
> I believe this is simply a matter of declaring the namespace in the wrong
> location. In Xquery, the namespace should be declared as part of the prologue,
> like this:
>
> declare @x xml
> set @x = '<ownershipDocument xmlns="http://iSemantex.com/ ownership4Document_M
2">
> <schemaVersion>X0202</schemaVersion>
> <documentType>4</documentType>
> <periodOfReport>2006-08-01Z</periodOfReport>
> </ownershipDocument>'
> select @x.query('declare default element namespace "http://iSemantex.com/ ownership4Document_M
2";
> //documentType')
>
> Looks to me like you've tried to declare it within the sum function.
>
> Thanks,
> Kent Tegels
> http://staff.develop.com/ktegels/
>
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com