tags:

views:

73

answers:

2

When I try to create UK for 7 columns I get

Total size of an index or primary key can not exceed 900 bytes.

How can I solve this error?

+1  A: 

Other than the obvious (changing the size of these 7 columns), there's no setting or similar. You can however enforce this by using triggers to ensure those 7 columns are unique together.

Vidar Nordnes
+4  A: 

Nothing particularly satisfactory. See this article for some suggestions of how a unique constraint can be enforced on columns over the 900 byte limit.

  • CHECKSUM (Possible collisions)
  • Triggers (High Overhead and might fail under snapshot isolation)
  • HASHBYTES (Less chance of collisions but still possible)
Martin Smith