How to create MS SQL Server 2005 unique key step by step example
Posted on | April 18, 2008 |
Looking at the title many of you may think what is the justification to write so basic stuff!
I admit. Honestly I also admit that I was searching for this over Google ! I am totally new to SQL server environment and also have no idea about its IDE. MySQL and PostgreSQL are the two DBMS which I have been using for long issuing the commands writing on the Linux console.
Anyway, here is how:
1. Connect to to the server and right click on the table you want add a unique key.
2. Click modify
3. Right click on the design panel and select Indexes/Keys.
4. A dialog will open and click the Add button on the lower left.
5. It will create a new entry on the list on the left panel of this dialog.
6. Click the browse button (button with three dots ‘…’) on the right of the first item(Columns) in the list on the right panel.
7. On clicking button a new dialog will appear with a list. This list items contains all the column names in a drop down combo box. Select the column you want to set unique from the drop down.
If you want have multiple columns together is unique, select the columns on the second row.
Say, besides the ID column, you also want to have names to be unique for each role type. So you have to select both the name and role columns.
It will automatically add a new row to give option for the third column which can left empty.
Click ok when done. It will close the dialog.
8. Now, click on the combo right the the field named “Type“. Select Unique Key. And click Close not Add.
That’s All ! You have successfully set up a unique in MS SQL Server 2005
Sorry.. my previous hosting service crashed and all images are gone
![]()
Comments
5 Responses to “How to create MS SQL Server 2005 unique key step by step example”
Leave a Reply
July 15th, 2008 @ 10:18 pm
Thanks a lot
July 15th, 2008 @ 10:26 pm
Its my pleasure
July 17th, 2008 @ 7:48 am
THANKSSSSSSSSSSSSSSSSSS !!!!!!!!!!!!!!!
Very useful and helpful
July 19th, 2008 @ 5:49 am
Thank you for visiting my blog:)
Why don’t you start one !?
November 3rd, 2008 @ 3:31 am
Great! Thanks Buddy For your help