SQLXML Import Schema - must complexTypes always create separate ta



All,

Was wondering if there was a way to have complexTypes (or use an alternate
method to...) augment columns to an existing table rather than create a new
one with relations.

SIMPLE EXPLANATION OF ISSUE
For example, I have a phoneType that consists of area code and number. When
used, i would like it add the area code and number fields to the referenced
table. Instead SQLXML wants to create a phoneType table with a link to the
referenced table.

Perhaps I am using the complexType incorrectly in this instance.

Any help would be greatly appreciated. I would like to avoid
over-normalizing my data.

Thanks a lot.

Paul



<?xml version="1.0"?>
<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="CustOrders"
parent="dbo.Customer"
parent-key="CustomerID"
child="dbo.SalesOrderHeader"
child-key="CustomerID" />
<sql:relationship name="OrderOrderDetail"
parent="dbo.SalesOrderHeader"
parent-key="SalesOrderID"
child="dbo.SalesOrderDetail"
child-key="SalesOrderID" />
</xsd:appinfo>
</xsd:annotation>

<xsd:element name="Customer" sql:relation="dbo.Customer"
type="CustomerType" />

<xsd:complexType name="CustomerType" >
<xsd:sequence>
<xsd:element name="Orders"
sql:relation="dbo.SalesOrderHeader"
sql:relationship="CustOrders" />
<xsd:element ref="phoneLandLine"/>
</xsd:sequence>
<xsd:attribute name="CustomerID" type="xsd:ID"/>
<xsd:attribute name="TerritoryID"/>
<xsd:attribute name="AccountNumber"/>
<xsd:attribute name="CustomerType"/>
<xsd:attribute name="Orders" type="xsd:IDREFS" sql:prefix="Ord-"/>

</xsd:complexType>

<xsd:element name="Order" sql:relation="dbo.SalesOrderHeader"
type="OrderType"/>

<xsd:complexType name="OrderType">
<xsd:sequence>
<xsd:element name="OrderDetail"
sql:relation="dbo.SalesOrderDetail"
sql:relationship="OrderOrderDetail" />
</xsd:sequence>
<xsd:attribute name="SalesOrderID" type="xsd:ID" sql:prefix="Ord-"/>
<xsd:attribute name="SalesPersonID"/>
<xsd:attribute name="OrderDate"/>
<xsd:attribute name="DueDate"/>
<xsd:attribute name="ShipDate"/>
</xsd:complexType>

<xsd:element name="OrderDetail" sql:relation="dbo.SalesOrderDetail"
type="OrderDetailType"/>

<xsd:complexType name="OrderDetailType">
<xsd:attribute name="ProductID" type="xsd:IDREF"/>
<xsd:attribute name="UnitPrice"/>
<xsd:attribute name="OrderQty"/>
<xsd:attribute name="UnitPriceDiscount"/>
</xsd:complexType>

<xsd:element name="UnitPriceDiscount" sql:relation="dbo.SalesOrderDetail"
type="DiscountType"/>

<xsd:complexType name="DiscountType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>

<xsd:element name="Contact" sql:relation="dbo.Contact" type="ContactType"/>

<xsd:complexType name="ContactType">
<xsd:attribute name="ContactID"/>
<xsd:attribute name="LastName"/>
<xsd:attribute name="FirstName"/>
<xsd:attribute name="Title"/>
</xsd:complexType>

<xsd:element name="phoneLandLine" type="phoneType"/>

<xsd:element name="areaCode" type="xsd:float"/>

<xsd:complexType name="phoneType">
<xsd:sequence>
<xsd:element ref="areaCode"/>
<xsd:element name="number" type="xsd:decimal"/>
</xsd:sequence
</xsd:complexType >

</xsd:schema>
.