The following create xml schema collection code returns the error of
Msg 9336, Level 16, State 1, Line 34 The XML Schema syntax 'unique' is not supported.
create xml schema collection cs.T as N'
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Column">
<xsd:unique name="uniqueKey">
<xsd:selector xpath="@ColumnKey"/>
<xsd:field xpath="."/>
</xsd:unique>
</xsd:element>
</xsd:schema>';
Is there any way to set unique constraint by other ways?
That is correct:
<xsd:unique>is unsupported. From the documentation:As the documentation states, the same issue applies to
<xsd:key>and<xsd:keyref>as well.