Jump to content
Sign in to follow this  
Aslan4u

Per Microsoft SQL Server XML Generieren [FOR XML PATH]

Recommended Posts

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

Edited by Aslan4u

Share this post


Link to post
Share on other sites
Der letzte Beitrag zu diesem Thema ist mehr als 180 Tage alt. Bitte überlege Dir, ob es nicht sinnvoller ist ein neues Thema zu erstellen.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

Werbepartner:



×
×
  • Create New...