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
 Transact-SQL (2000)
 Triggers to fire once across joined tables

Author  Topic 

JubJub
Starting Member

4 Posts

Posted - 2005-12-01 : 13:05:17
My situation is that I have 2 tables. One is an Order table, the other is the Order_AddOn table in a 1-1 join on OrderID. The combination of these 2 tables is our order record, viewed as one "item" in the client app. We are trying to audit changes and additions to the system via triggers.

The pseudo-description of what I want is this: I want a trigger that detects changes in both the tables but notes them as one table in terms of trigger activity. If an edit actually changes values in both tables, I only want "a" trigger to fire once.

I need to have the trigger work as though the joined tables are actually one, in terms of trigger.

I hope this makes sense. Thanks in advance for any assistance you can provide me.

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-12-01 : 13:37:18
two thoughts come to mind.

Let your app post to a VIEW of the 2 tables and put INSTEAD OF triggers on the view.
or
let your tables fire triggers independently and present the audit information in an aggregated form.

Be One with the Optimizer
TG
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-12-01 : 13:56:19
What TG said

Kristen
Go to Top of Page
   

- Advertisement -