You are here: Re: Trigger problem « MsSQL Server « IT news, forums, messages
Re: Trigger problem

Posted by Jason Lepack on 06/11/07 19:33

So based on your description, anything at all can be put into pk_A.
However, in B you to make sure that anything put into B.fk_B_A must
already exist in A.pk_A

Based on your DDL you can remove the constraint on fk_B_A because
we're going to replace this functionality with a Trigger.

Since this is educational I will direct you to look at the INSTEAD OF
clause for triggers, and tell you that you need the trigger to be on
B, not A.

If you are still stuck, just post back.

Cheers,
Jason Lepack

On Jun 11, 2:55 pm, Wojto <jestem.woj...@interia.pl> wrote:
> Well.. to be honest I need to solve this problem as academic exercise...
> It is rather didactic than business problem. So I need to enforce the
> relationship and it must be done with trigger. It will be checked by
> trial of puting wrong data in the tables (rollback) and than correct
> data (normal commit). But with my declaration I can't put anything in
> the tables... The trigger is fired just after the insert while I need it
> to be fired, lets say, on commit. So this is the "real" prblem :-)
>
> Thanx and sorry for this mess :-)

 

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

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