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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 DB table/key design question

Author  Topic 

vmon
Yak Posting Veteran

63 Posts

Posted - 2003-06-11 : 10:22:07
I have a table with GUID as the key and email address as a second column.

If I don't want email addresses to repeat is there a way in table design or relationships to force this? I know I can do it with programming on the user interface side I just thought if the DB could force it that was a better way to handle the situation.

Thanks,
vmon

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2003-06-11 : 10:35:05
You Could Create A Unique Index.

From: BOL.............

Syntax
CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
ON { table | view } ( column [ ASC | DESC ] [ ,...n ] )
[ WITH < index_option > [ ,...n] ]
[ ON filegroup ]

< index_option > :: =
{ PAD_INDEX |
FILLFACTOR = fillfactor |
IGNORE_DUP_KEY |
DROP_EXISTING |
STATISTICS_NORECOMPUTE |
SORT_IN_TEMPDB
}



Jim
Users <> Logic
Go to Top of Page

vmon
Yak Posting Veteran

63 Posts

Posted - 2003-06-11 : 10:49:12
Excellent!

Go to Top of Page
   

- Advertisement -