Results 1 to 4 of 4

Thread: Trigger for DELETED?

Threaded View

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Trigger for DELETED?

    Hi.
    Mssql
    Just making sure I understand this correctly.

    I'm viewing a trigger created by someone else that reads:
    FOR INSERT, UPDATE
    And the I have this:

    -- only update if the password has actually been changed
    IF EXISTS(SELECT 1 FROM INSERTED i JOIN DELETED d ON i.person_id = d.person_id WHERE i.person_password <> ISNULL(d.person_password, ''))

    So the question is the DELETED. Why the comment writes only update if changed? What it looks like is only update if a row is bound to be deleted. Mind you I have never used Deleted and searching does not reveal any article. IS DELETED actually a trigger command?

    Thanks

    Edit: I guess Deleted is the changing column? They could have picked a better name :P
    Last edited by sapator; Oct 24th, 2024 at 08:32 AM.
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width