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

Posted by Wojto on 06/11/07 18:32

Well.. This tables are only an example... They are much more complex in
fact, so I can't simply put data in the B table. I need to do it in
"normal" way. But after puting something into table A the trigger fires
and removes the invalid record (rollback), so I can't put anything into
the tables. So if the trigger is correct how can I put something into
both tables without doing it in the body of the trigger.
:-)
Thanx for help

> So let's get this straight.
>
> The constraint on fk_B_A will not let you enter data into that field
> unless it already exists in pk_A in A.
>
> Your trigger that you have created will ensure that no data will get
> into pk_a that does not already exist in fk_B_A, so it seems to be
> working fine.
>
> What exactly do you want to do? Do you want to ensure that after you
> insert a record into A, a matching record gets inserted into B?
>
> If so then your trigger should insert a record if one didn't exist.

 

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

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