PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.db.ms-sqlserver > Me create XML Schema file for XML Bulk Load into SQL!!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Me create XML Schema file for XML Bulk Load into SQL!!

Réponse
 
LinkBack Outils de la discussion
Vieux 25/03/2008, 19h20   #1
DennBen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Me create XML Schema file for XML Bulk Load into SQL!!

I'm using SQL 2005 and am trying to use the XML Bulk Load COM
object to import XML data into a table. I'm having difficulty mapping
schema file. In the MS SQL Documentation I found an example using this
XML format:
<ROOT>
<Customers>
<CustomerId>1111</CustomerId>
<CompanyName>Sean Chai</CompanyName>
<City>NY</City>
</Customers>
<Customers>
<CustomerId>1112</CustomerId>
<CompanyName>Tom Johnston</CompanyName>
<City>LA</City>
</Customers>
<Customers>
<CustomerId>1113</CustomerId>
<CompanyName>Institute of Art</CompanyName>
</Customers>
</ROOT>

and how the above format would translate to this schema:
<?xml version="1.0" ?>
<Schema xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:dt="urn:schemas-microsoft-com:xml:datatypes"
xmlns:sql="urn:schemas-microsoft-com:xml-sql" >

<ElementType name="CustomerId" dt:type="int" />
<ElementType name="CompanyName" dt:type="string" />
<ElementType name="City" dt:type="string" />

<ElementType name="ROOT" sql:is-constant="1">
<element type="Customers" />
</ElementType>

<ElementType name="Customers" sql:relation="Customer">
<element type="CustomerId" sql:field="CustomerId" />
<element type="CompanyName" sql:field="CompanyName" />
<element type="City" sql:field="City" />
</ElementType>

</Schema>

That's nice and all, but my XML file isn't so simple. I've got nested
elements in it, and this doesn't show me how to map nested elements in
a schema file.

For example if my XML file was this:
<ROOT>
<Customers>
<CustomerId>1112</CustomerId>
<CompanyName>Tom Johnston</CompanyName>
<Demographics>
<CityInfo State="CA" zip="11222">LA</CityInfo>
</Customers>

</ROOT>

How would I create a schema file to map to that?

Can anyone ??!!
  Réponse avec citation
Vieux 25/03/2008, 19h54   #2
Plamen Ratchev
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Me create XML Schema file for XML Bulk Load into SQL!!

See if the use of complexType in the following examples will you:
http://blogs.msdn.com/monicafrintu/a...lbulkload.aspx
http://msdn2.microsoft.com/en-us/library/aa225754.aspx

HTH,

Plamen Ratchev
http://www.SQLStudio.com

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h09.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08976 seconds with 10 queries