Добро пожаловать в форум, Guest  >>   Войти | Регистрация | Поиск | Правила | В избранное | Подписаться
Все форумы / Microsoft SQL Server Новый топик    Ответить
 Schema: missing key on  [new]
efiml
Member

Откуда:
Сообщений: 13
Есть 2 Таблицы
1. [owners] (
[unikey] [char] (15) ,
[anchor] [char] (15) ,
[no] [char] (25) ,
[NOVLA] [char] (14) ,
[FIO] [varchar] (200) ,
[dolya] [char] (20) ,
[INN] [char] (12) ,
[ccr] [smallint] ,
[ADDRU] [varchar] (150) ,
[VIDDOC] [smallint] NULL ,
[PASPORT] [varchar] (100) ,
[nompsp] [char] (13) ,
[NAMEUD] [char] (80) ,
[PRIZN] [tinyint] ,
[DBORN] [datetime] ,
[regorg] [varchar] (250) ,
[dregown] [datetime] ,
[DATAREG1] [datetime] ,
[nameprapol] [varchar] (60) ,
[GNI] [char] (4) )
2. own_doc
[datadoc] [smalldatetime] NULL ,
[nomdoc] [char] (25) ,
[namedoc] [varchar] (196) ,
[anchor] [char] (15)

Пишу схему

<?xml version="1.0"?>
<Schema name="RealRightSchema"
xmlns="urn:schemas-microsoft-com:xml-data"
xmlns:sql="urn:schemas-microsoft-com:xml-sql"
xmlns:dt="urn:schemas-microsoft-com:datatypes">

<ElementType name="own_doc" sql:relation="own_doc">
<AttributeType name="datadoc"/>
<attribute type="datadoc" sql:field="datadoc" />
<AttributeType name="nomdoc"/>
<attribute type="nomdoc" sql:field="nomdoc"/>
<AttributeType name="namedoc"/>
<attribute type="namedoc" sql:field="namedoc"/>
</ElementType>


<ElementType name="owners" sql:relation="owners">
<AttributeType name="unikey"/>
<attribute type="unikey" sql:field="unikey"/>
<AttributeType name="anchor"/>
<attribute type="anchor" sql:field="anchor"/>
<AttributeType name="fio"/>
<attribute type="fio" sql:field="fio"/>
<AttributeType name="no"/>
<attribute type="no" sql:field="no"/>
<AttributeType name="novla"/>
<attribute type="novla" sql:field="novla"/>
<AttributeType name="dolya"/>
<attribute type="dolya" sql:field="dolya"/>
<AttributeType name="inn"/>
<attribute type="inn" sql:field="inn"/>
<AttributeType name="addru"/>
<attribute type="addru" sql:field="addru"/>
<AttributeType name="pasport"/>
<attribute type="pasport" sql:field="pasport"/>
<AttributeType name="nompsp"/>
<attribute type="nompsp" sql:field="nompsp"/>
<AttributeType name="nameud" />
<attribute type="nameud" sql:field="nameud"/>
<AttributeType name="prizn" />
<attribute type="prizn" sql:field="prizn"/>
<AttributeType name="dborn" />
<attribute type="dborn" sql:field="dborn"/>
<AttributeType name="regorg"/>
<attribute type="regorg" sql:field="regorg"/>
<AttributeType name="dregown" />
<attribute type="dregown" sql:field="dregown"/>
<AttributeType name="datareg1" />
<attribute type="datareg1" sql:field="datareg1"/>
<AttributeType name="ccr"/>
<attribute type="ccr" sql:field="ccr"/>
<AttributeType name="nameprapol" />
<attribute type="nameprapol" sql:field="nameprapol"/>
<element type="own_doc">
<sql:relationship key_relation="owners"
key="unikey" foreign-relation="own_doc"
foreign-key="anchor"/>
</element>
</ElementType>
</Schema>

и шаблон
<?xml version='1.0' encoding="windows-1251" ?>
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:xpath-query mapping-schema="test.xml">
/owners
</sql:xpath-query>
</ROOT>

Выполняю в браузере и получаю сообщение
<?xml version="1.0" encoding="windows-1251" ?>
- <ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<?MSSQLError HResult="0x80004005" Source="Microsoft XML Extensions to SQL Server" Description="Schema: missing key on own_doc"?>
</ROOT>

В чем я не прав?
25 дек 03, 09:27    [473305]     Ответить | Цитировать Сообщить модератору
Все форумы / Microsoft SQL Server Ответить