Column '' in table '' is of a type that is invalid for use as a key column in an index.

I've tried to create a simple (unique) constraint across multiple columns:

However I was greeted by:

Column 'Name' in table 'dbo.UserLocations' is of a type that is invalid for use as a key column in an index.

This can be fixed by adding: [DataType("VARCHAR")] and [MaxLength(40)] on the string. The point is that MaxLength cannot be set to maximum.

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box