Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2003, 03:32 PM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Triggers

Hi all:


I am trying to achieve the following:

1. There are 2 tables TABLE1 and TABLE2. Each has a delete trigger on its own. TABLE2 is a child table of TABLE1.
2. When I delete a record in TABLE1, the TABLE1 delete trigger is fired, which will delete records in TABLE2, firing its delete trigger.
3. The point is: from within the delete trigger of TABLE2 I want to access the DELETED table of TABLE1.

There are other processes that delete records from TABLE2 without deleting a record in TABLE1, so that has to be considered. (Cascading Referential integrity through foreign key constraints will not work here because the trigger does a lot of things)

The solution I am thinking of is using a temp table to store the DELETED table for TABLE1 so that the delete trigger for TABLE2 can read it; I am looking for a better solution than this.


TIA,
Bernard Omiple
 
Old October 1st, 2003, 02:29 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What is your delete triger doing on Table2? Table1?
You may be able to do it all from within your Table2 trigger.

Sal






Similar Threads
Thread Thread Starter Forum Replies Last Post
Triggers? odezzie Classic ASP Databases 1 March 28th, 2007 06:09 PM
Triggers mrookey SQL Server 2000 2 October 24th, 2006 07:11 AM
Triggers? prabodh_mishra Oracle 2 March 30th, 2006 05:51 AM
Triggers shahchi1 SQL Server 2000 1 November 1st, 2004 06:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.