You are here: Re: what type of Constraint to prevent duplicates « MsSQL Server « IT news, forums, messages
Re: what type of Constraint to prevent duplicates

Posted by Chandra on 06/09/05 06:34

Hi
For this you can create a composite primary key or this can be done by
using INSTEAD OF INSERT Trigger


something like this:

CREATE TRIGGER <TriggerName>
INSTEAD OF INSERT
AS
BEGIN

IF NOT EXISTS(SELECT * FROM bstresult INNER JOIN INSERTED ON
INSERTED.serial = bstresult.serial AND INSERTED.testresult =
bstresult.testresult)
INSERT INTO bstresult SELECT * from INSERTED

END

please let me know if it worked.

best Regards,
Chandra
http://groups.msn.com/SQLResource/
http://chanduas.blogspot.com/
---------------------------------------

*** Sent via Developersdex http://www.developersdex.com ***

 

Navigation:

[Reply to this 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

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