Use Enterprise Manager to Design the table.
Create the new column.
Select the newly created column, right click, Indexes/Keys.
Create a new index on the column name, and make sure to check "Create Unique" before saving amended design.
Any attempt to insert a non-unique value into the new column will result in a Violation of Unique Key Constraint error.
Is this what you wanted to do?
Thank you. It is what I want. It is better to setup in SQL server for unique or use code to violate user's input? That is, as I did before, I used code to check user's input with SQL server to find out if input is unique or not.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.