After INSERT/UPDATE Trigger - Getting old values?

  • I've never liked using JOIN's in delete statements, but I think you'd have to do it like this:

    CREATE TRIGGER [t_ptSchedule_TO_ptAppointmentsDELETE]

    ON [dbo].[ptSchedule]

    AFTER DELETE

    AS

    BEGIN

    SET NOCOUNT ON;

    DELETE ptAppointments FROM ptAppointments a

    JOIN DELETED d ON a.ID = d.ScheduleID

    END

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing post 16 (of 15 total)

You must be logged in to reply to this topic. Login to reply