unique - How to make "No Duplicates" column in SQL Server 2008? -
I have a simple table in my SQL Server database This table has two columns: ID int, name nvarchar (50)
. The ID
column is the primary key for my table.
I want to be " name
" column " (no duplicate)
", such as in Microsoft Access, but this column is not the primary column How can I do this?
Add one for that column:
SQL Management Studio UI To add it through: - Open SQL Server Management Studio.
- Expand the tables in the database's folder, where you want to interrupt.
- Right-click on the table where you want to add constraint and click Design .
- In the table designer, click on Index / Key .
- Click Add .
- Select Unique Key in the Type drop-down list.
To handle such a situation where there is a unique obstacle infringement,
Comments
Post a Comment