Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Alter Table To Set Unique Field - SqlServer 2008

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2011-06-20 : 01:53:06
Hi,
I have table MyAddress like the below..

Door_no nvarchar(25)
Street nvarchar(50)
Road nvarchar(50)
city nvarchar(50)
state nvarchar(50)
country nvarchar(50)

Now I like to set this field Door_no to be Unique field.

For that any ideas?

Thanks for the helps

Paramu @ PARANTHAMAN

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2011-06-20 : 02:31:31
Making Door_no as UNIQUE is sensible?

Different person have same door no in different street/city/state/country.

Any way the synatx is

ALTER TABLE <table_name> ADD UNIQUE (column_name)

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

paramu
Posting Yak Master

151 Posts

Posted - 2011-06-20 : 02:52:14
Hi Senthil Nagore,
Thanks For The Comments!


Paramu @ PARANTHAMAN
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2011-06-20 : 02:58:39
quote:
Originally posted by paramu

Hi Senthil Nagore,
Thanks For The Comments!


Paramu @ PARANTHAMAN



Welcome

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -