共用方式為


混合的類型與簡單的內容

適用於:SQL ServerAzure SQL DatabaseAzure SQL 受控執行個體

SQL Server 不支援將混合類型限制為簡單內容。

範例

在下列 XML 結構描述集合中, myComplexTypeA 是可以清空的複雜類型。 也就是說,它的兩個元素都會將 minOccurs 設定為 0。 不支援透過在 myComplexTypeB 宣告中的方式,將此限制為簡單內容。 因此,下列 XML 結構描述集合的建立將會失敗:

CREATE XML SCHEMA COLLECTION SC AS '
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ns" xmlns:ns="http://ns"
xmlns:ns1="http://ns1">
    <complexType name="myComplexTypeA" mixed="true">
        <sequence>
            <element name="a" type="string" minOccurs="0"/>
            <element name="b" type="string" minOccurs="0" maxOccurs="23"/>
        </sequence>
    </complexType>
    <complexType name="myComplexTypeB">
        <simpleContent>
            <restriction base="ns:myComplexTypeA">
                <simpleType>
                    <restriction base="int">
                        <minExclusive value="25"/>
                    </restriction>
                </simpleType>
            </restriction>
        </simpleContent>
    </complexType>
</schema>
';
GO

另請參閱