Microsoft MVPs inside





 MCSEboard.de – IT Pro Forum zu Windows Server 2008 R2 / 2008 / 2003 & Windows 7 / Vista / XP
Registrieren Hilfe Regeln Benutzerliste Suchen Heutige Beiträge Alle Foren als gelesen markieren

MS SQL Server Forum


Alles zum Thema Microsoft SQL Server — Q & A zu Microsoft SQL Server 2000 / 2005 / 2008 Architektur, Konfiguration, Troubleshooting


Antwort
     
Themen-Optionen
Alt 07.12.2011, 17:28   #1
Newbie
 
Offline
Registriert seit: 12-2011
Beiträge: 1
Per Microsoft SQL Server XML Generieren [FOR XML PATH]

Hallo Leute ,
Breuchte euer hilfe,
ich muss mit SQL server XML Export (für schnittstelle) schreiben.

Ich habe folgende problem.
Fehler:
Die attributzentrierte 'custom-attributes/custom-attribute/@name'-Spalte darf in der XML-Hierarchie in FOR XML PATH nicht auf ein nicht attributzentriertes gleichgeordnetes Element folgen.


MEIN SQL

WITH XMLNAMESPACES(
'http://www.xxxxx.com/xml/ns/xyz' as x ,
'http://www.w3.org/2001/XMLSchema-instance' as xsi,
'http://www.xxxxx.com/xml/ns/xxx-dt' as dt
)
select top 2
USER_MinREF "@SKU",
USER_MinREF as SKU,
(case when wawiaktiv='-1' then 1 else 0 end) as "available",
(case when wawiaktiv='-1' then 1 else 0 end) as "available-status",
(case when ShopRPAktiv='-1' then 1 else 0 end) as "online",
'de-CH' as "name/@xml:lang",
Bezeichnung1 as "name",
'de-CH' as "Short-description/@xml:lang",
OlBezeichnung5 as "Short-description",

/* CUSTOM ATTRIBUTES*/
-- ** displayName ** --
'USER_Modell_displayName' as "custom-attributes/custom-attribute/@name",
'string' as "custom-attributes/custom-attribute/@dt:dt",
'de-CH' as "custom-attributes/custom-attribute/@xml:lang",
'Gender' as "custom-attributes/custom-attribute",

-- ** displayValue ** --
'USER_Modell_value' as "custom-attributes/custom-attribute/@name",
'string' as "custom-attributes/custom-attribute/@dt:dt",
USER_Modell as "custom-attributes/custom-attribute/USER_Modell_value"


from
artikel
FOR XML PATH ('product'), ROOT('myRoot')




MUSTER:

<myRootxmlns:dt="http://www.***.com/xml/ns/***/impex-dt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:x="http://www.***.com/xml/ns/***mpex">
<product SKU="52267215">
<SKU>52267215</SKU>
<available>1</available>
<available-status>1</available-status>
<online>0</online>
<name xml:lang="de-CH">PRODUKT1</name>
<Short-description xml:lang="de-CH">Produkt 1 beschreibung</Short-description>
<custom-attributes>
<custom-attribute name="USER_Modell_displayName" dt:dt="string" xml:lang="de-CH">Gender</custom-attribute>
<custom-attribute name="USER_Modell_value" dt:dt="string">Unisex</custom-attribute>

</custom-attributes>
</product>
<product SKU="52267215">
<SKU>52267215</SKU>
<available>1</available>
<available-status>1</available-status>
<online>0</online>
<name xml:lang="de-CH">Produkt2</name>
<Short-description xml:lang="de-CH">Produkt2 Beschreibung</Short-description>
<custom-attributes>
<custom-attribute name="USER_Modell_displayName" dt:dt="string" xml:lang="de-CH">Gender</custom-attribute>
<custom-attribute name="USER_Modell_value" dt:dt="string">Unisex</custom-attribute>

</custom-attributes>
</product>
</myRoot>



1.Wie kann ich das umsätzten
2. Gibt es andere weg =?
3. wie erstellt ihr aus MSSQL datenbank XML


Würde mich über jedes Positives antwort freuen.
Grüsse ASLAN4U

Geändert von Aslan4u (07.12.2011 um 22:22 Uhr).
    Mit Zitat antworten
Antwort


Themen-Optionen


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
2003 Server: Windows cannot access the specified device, path, or file. svaste Windows Server Forum 0 26.12.2006 00:05
Traps generieren goldi01 Cisco Forum — Allgemein 7 21.08.2006 08:03
Microsoft SQL Server 2005 Standard + Microsoft CRM 3.0 127.0.0.1 MS SQL Server Forum 1 13.03.2006 21:00
Wasserzeichen generieren! casiemir Off Topic 1 09.12.2004 22:39
rma generieren e-mail DJ-Silver Windows Forum — Allgemein 0 16.02.2004 15:49


Alle Zeitangaben in MEZ/CET. Es ist jetzt 21:05 Uhr. Seite generiert in 0,028 Sekunden.

- Unsere Partner -

Copyright © 2000 – 2012 MCSEboard.de

Sprung zum Seitenanfang