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 :
Currently, SQL Server does not support these XSD-based constraints for enforcing uniqueness or establishing keys and key references. XML schemas that contain these elements cannot be registered.
As the documentation states, the same issue applies to <xsd:key>
and <xsd:keyref>
as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.