Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-29 : 08:48:57
|
| Greg writes "HiI modified an example given with SQLXML 3(service pack1) to load an XML file into 3 related tables and got an error.Here is the description:CREATE TABLE Cust ( CustomerID int PRIMARY KEY, CompanyName varchar(20) NOT NULL, City varchar(20) DEFAULT 'Seattle')GOCREATE TABLE CustOrder ( OrderID int PRIMARY KEY, CustomerID int FOREIGN KEY REFERENCES Cust(CustomerID))GOCREATE TABLE CustPeople ( PersonID int PRIMARY KEY, CustomerID int FOREIGN KEY REFERENCES Cust(CustomerID))GOHere is a file SampleXMLData3.xml to load:<ROOT> <Customers> <CustomerID>1111</CustomerID> <CompanyName>Hanari Carnes</CompanyName> <City>NY</City> <Order OrderID="1" /> <Order OrderID="2" /> <Person PersonId="21" /> <Person PersonId="23" /> </Customers> <Customers> <CustomerID>1112</CustomerID> <CompanyName>Toms Spezialitten</CompanyName> <City>LA</City> <Order OrderID="3" /> <Person PersonId="123" /> <Person PersonId="156" /> </Customers> <Customers> <CustomerID>1113</CustomerID> <CompanyName>Victuailles en stock</CompanyName> <Order OrderID="4" /> <Person PersonId="267" /> <Person PersonId="289" /> </Customers></ROOT>Here is the content of SampleSchema3.xml file:<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sql="urn:schemas-microsoft-com:mapping-schema"><xsd:annotation> <xsd:appinfo> <sql:relationship name="CustCustOrder" parent="Cust" parent-key="CustomerID" child="CustOrder" child-key="CustomerID" /> <sql:relationship name="CustCustPeople" parent="Cust" parent-key="CustomerID" child="CustPeople" child-key="CustomerID" /> </xsd:appinfo></xsd:annotation> <xsd:element name="Customers" sql:relation="Cust" > <xsd:complexType> <xsd:sequence> <xsd:element name="CustomerID" type="xsd:integer" /> <xsd:element name="CompanyName" type="xsd:string" /> <xsd:element name="City" type="xsd:string" /> <xsd:element name="Order" sql:relation="CustOrder" sql:relationship="CustCustOrder" > <xsd:complexType> <xsd:attribute name="OrderID" type="xsd:integer" /> </xsd:complexType> </xsd:element> <xsd:element name="Person" sql:relation="CustPeople" sql:relationship="CustCustPeople" > <xsd:complexType> <xsd:attribute name="PersonID" type="xsd:integer" /> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element></xsd:schema>When I execute a vbscript to load the XML data in the db, I get an error"<?xml version="1.0"?><Result State="FAILED"><Error><HResult>0x80004005</HResult><Description>< |
|
|
|
|
|