|
next
|
Subject: SQL/XML Error Author: Wagner Reinhard Date: 09 Jun 2005 04:28 AM
|
ok thank you.
I have another problem : When I execute above "SQL/XML" I always get an error like this: "Nested query 1 should select at least one column."
I should fulfill the DTD:
DOCTYPE Mondial[
<!Element Mondial(Kontinent+,Land+)>
<!Element Kontinent(LName,Prozent)+>
<!Element Land(LName,Stadt*)>
<!Element Stadt(Sname,Einwohner)>
<!Element SName(#PCDATA)>
<!Element Einwohner (#PCDATA>
<!Element LName(#PCDATA>
<!Element Prozent(#PCDATA>
<!ATTLIST Kontinent KName #REQUIRED>
]
The tables are
LAND : LCode,LName,HStadt,Fläche
Stadt: SName,PName,LCode,Einwohner
Lage : LCode,Kontinent,Prozent
It does not work and I dont know why ? Please help me !
Reinhard
SELECT XMLElement
(
NAME Mondial,
(
SELECT XMLElement
(
NAME Kontinent,
XMLAttributes (La.Kontinent AS KName),
XMLElement (NAME LName, L1.LName),
XMLElement (NAME Prozent, La.Prozent)
)
FROM My.dbo.Lage La
),
(
SELECT XMLElement
(
NAME Land,
XMLElement(NAME LName, L2.LName),
XMLAGG
( XMLELEMENT
( NAME Stadt,
XMLElement (NAME SName, Stadt.SName),
XMLElement (NAME Einwohner,Stadt.Einwohner)
)
ORDER BY Stadt.Einwohner DESC
)
)
FROM My.dbo.Land L2, My.dbo.Stadt Stadt
WHERE L1.LCode = L2.LCode AND Stadt.LCode = L2.LCode
GROUP BY L2.LName
)
) AS Mondial
FROM My.dbo.Land L1
|
|
|
|