Pages

Saturday 2 July 2011

Unique Key on 2 columns in SQL Server.

1 comments
 
Hi friends,in this post i would like to explain how to create Unique Key on 2 columns in SQL Server.

For Example:

Here i am created Unique Key for 2 columns(Name,SurName) on College table.

CREATE TABLE [dbo].[College] ADD CONSTRAINT [UK_College] UNIQUE NONCLUSTERED
(
[Name] ,
[SurName]
)
WITH (PAD_INDEX = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]

Thank you...

Shout it

One Response so far.

  1. This is one of the best answer so far, I have read online. Just useful information. Very well presented. I had found another good collection of sql keys over internet.
    please check out this link...

    http://mindstick.com/Articles/d837d16c-d483-4948-ad18-41b405c011bd/?Important%20SQL%20Keys

Leave a Reply