Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set up unique column in another column besides primary key

Status
Not open for further replies.

adonet

MIS
May 4, 2004
312
US
Is it possible to set up unique column in another column besides primary key? How to do it?
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top