I had watch youtube video tutorial teaching how to create unique key
http://www.youtube.com/watch?v=oqrsfatxTYE&list=PL08903FB7ACA1C2FB&index=9
In the video, he has created a unique key for Email(nvarchar) column, I could create it when I create database manually, but when I try create unique key for a database created with entity framework code first, using the next query
ALTER TABLE Peoples
ADD CONSTRAINT UQ_MyTable_Email UNIQUE (email)
It will generate a error:
Msg 1919, Level 16, State 1, Line 2
Column 'email' in table 'Peoples' is of a type that is invalid for use as a key column in an index.
What is problem? what can I do for create unique key for nvarchar(max) column?