Reply to Re: adding unique keys

Your name:

Reply:


Posted by SQL Menace on 08/22/06 19:38

create a primary key or a unique constraint

ALTER TABLE [dbo].[YourTable] WITH NOCHECK ADD
CONSTRAINT [YourTable_PK] PRIMARY KEY CLUSTERED
(
[office code],
[office id],
[office section]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO

or

ALTER TABLE dbo.YourTable ADD CONSTRAINT
IX_YourTable UNIQUE NONCLUSTERED
(
[office code],
[office id],
[office section]

) ON [PRIMARY]

Denis the SQL Menace
http://sqlservercode.blogspot.com/


HandersonVA wrote:
> Would anyone please instruct how to prevent the duplicate record by
> setting the unique keys on the ms sql server? i've been checking the
> duplicate record as front-end and i found out if there is an internet
> delay or some other reasons, it has a chance to store the duplicated
> data into the database. so i realized it has to be done on the back-end
> side.
> for example, if i have three columns (office code, office id, office
> section) as a unique key, how can i setup this? thanks in advance.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация