Here's a Sample xml document I'm trying to create a schema for:
'<Fields>
<Field ID="-1">somevalue</Field>
<Field ID="-2" />
<Field ID="-3" />
<Field ID="-4">Some other value</Field>
<Field ID="-5" />
</Fields>'
I'm trying to create a SQL Server 2005 schema collection to:
1. prevent dupicate id's.
2. only allow negative ids.
I can achieve the negative constraint with type="xs:negativeInteger" for the id attribute. But I can't create a unique constraint or key\keyref in SQL 2005. If I set my type="xs:ID", then I cant use numbers at all for my ID values, nevermind negative IDs.
Either I'm missing something, or its not possible. If its not possible, why would SQL 2005 not support the ability to have a unique attribute? Is there a work around using a constraint\trigger or an xml index on the table, or some other technique that I cant even imagine right now?
All help is greatly appreciated.