Results 1 to 4 of 4

Thread: FOR and AFTER

  1. #1
    Join Date
    Nov 2003
    Posts
    31

    Unanswered: FOR and AFTER

    Someone pls enlighten me...

    I understand that FOR TRIGGERS would be executed concurrently as the table is being updated/inserted/deleted

    &

    AFTER TRIGGER would only be executed after the UPDATE/INSERT/DELETE operation has been completed....am i right?

  2. #2
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140
    I never heard of FOR TRIGGERS. I only know about
    BEFORE TRIGGER (not supported by MSSQL, as far as I know)
    AFTER TRIGGER
    INSTEAD OF TRIGGER

    Where did you hear about FOR triggers ?

  3. #3
    Join Date
    Nov 2003
    Posts
    31
    ok sorry i didn't mean FOR triggers..

    what i meant was ..whats the difference between the following 2.

    ALTER TRIGGER SendMsgs ON asiapac702_test.dbo.tblCustServiceHistoryHdr FOR UPDATE
    AS....


    ALTER TRIGGER SendMsgs ON asiapac702_test.dbo.tblCustServiceHistoryHdr AFTER UPDATE
    AS....

  4. #4
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140
    Ok, now I get it.

    As far as I can understand from the documentation, FOR and AFTER are synonyms, from a syntax point of view.

    I did some testing, and found no differences between

    create trigger tai_t on t FOR insert as begin select 1 end
    create trigger tai_t2 on t AFTER insert as begin select 1 end

    Probably this has something to do with being ANSI/ISO or whatever compliant.

Posting Permissions

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