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: 

  1. Open SQL Server Management Studio.

  2. Expand the tables in the database's folder, where you want to interrupt.
  3. Right-click on the table where you want to add constraint and click Design .
  4. In the table designer, click on Index / Key .
  5. Click Add .
  6. Select Unique Key in the Type drop-down list.

To handle such a situation where there is a unique obstacle infringement,


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -