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 August 26th, 2003, 01:58 AM
Authorized User
 
Join Date: Jul 2003
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Looping in Triggers

1. How does SQL delete when it deletes in bulk?(like cascade delete of child tables)?

2. How do i loop the deleted items in the cascade delete table?
   This trigger works well in single delete but doesnt loop
   in bulk deletes. Can anyone Help?
   Sample Trigger:

CREATE TRIGGER UpdatePRPOed_D ON dbo.pur_tblpodet FOR DELETE AS

UPDATE mat_tblPurchaserequisitiondet
    SET mat_tblPurchaserequisitiondet.POed =
        mat_tblPurchaserequisitiondet.POed -
                (SELECT QTY FROM deleted
                WHERE PRNo = mat_tblPurchaserequisitiondet.PRNo AND
            StockCode = mat_tblPurchaserequisitiondet.StockCode)

    WHERE (mat_tblPurchaserequisitiondet.StockCode =
        (SELECT TOP 1 StockCode
        FROM deleted
        WHERE PRNo = mat_tblPurchaserequisitiondet.PRNo))


__________________
Proud To Be Pinoy





Similar Threads
Thread Thread Starter Forum Replies Last Post
triggers Hafiz Muhammad Mushtaq Oracle 5 April 9th, 2009 04:25 PM
triggers p330418 Oracle 3 October 20th, 2008 02:48 AM
Instead of triggers debbiecoates SQL Server 2000 2 April 28th, 2008 02:45 AM
About Triggers zee_ahmed2002 SQL Server 2000 2 August 20th, 2004 10:07 AM
Triggers! Anderson Mark Oracle 1 December 5th, 2003 01:34 PM





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