Professional Web Applications Themes

Order of execution - INSTEAD OF Trigger - Microsoft SQL / MS SQL Server

The record added using Insert statement of the stored procedure will not appear in the myPrimary table. The records added with following statements included in the trigger will show in the respective tables. INSERT INTO mySecondary SELECT * FROM inserted INSERT INTO myPrimary SELECT * FROM inserted Prasad Koukuntla "hngo01" <com> wrote in message news:028001c35858$27e6f680$gbl... ...

  1. #1

    Default Re: Order of execution - INSTEAD OF Trigger

    The record added using Insert statement of the stored procedure will not
    appear in the myPrimary table.

    The records added with following statements included in the trigger will
    show in the respective tables.

    INSERT INTO mySecondary SELECT * FROM inserted
    INSERT INTO myPrimary SELECT * FROM inserted

    Prasad Koukuntla

    "hngo01" <com> wrote in message
    news:028001c35858$27e6f680$gbl... 


    Prasad Guest

  2. #2

    Default Re: Order of execution - INSTEAD OF Trigger

    The record added using Insert statement of the stored
    procedure will not appear in the myPrimary table. SO WHERE
    IS IT? IT GOT OVERWRITTEN BY TRIGGER? THANKS

     
    procedure will not 
    the trigger will [/ref]
    Thanks 
    >
    >
    >.
    >[/ref]
    hngo01 Guest

  3. #3

    Default Re: Order of execution - INSTEAD OF Trigger

    When we use INSTEAD OF TRIGGER the standard action (UPDATE, INSERT or
    DELETE) is replace by the action specified inside the INSTEAD OF TRIGGER.

    Therefore, the INSERT statement inside the SP will activate the INSTEAD OF
    TRIGGER and the records added with the INSERT statements within the trigger
    would appear in the table.

    "hngo01" <com> wrote in message
    news:00e201c35860$ffc59770$gbl... 
    > procedure will not 
    > the trigger will [/ref]
    > Thanks 
    > >
    > >
    > >.
    > >[/ref][/ref]


    Prasad Guest

  4. #4

    Default Re: Order of execution - INSTEAD OF Trigger

    The row WILL be inserted into myPrimary, but not directly
    from the insert statement in the procedure. As stated, an
    INSTEAD OF trigger replaces, not augments, the specified
    action. But... you have (properly) repeated the insert
    into myPrimary within the INSTEAD OF trigger, so that will
    result in the row being inserted.

    HTH
    Vern
     
    WHERE 
    >procedure will not 
    >the trigger will [/ref][/ref]
    then [/ref]
    >Thanks 
    >>
    >>
    >>.
    >>[/ref]
    >.
    >[/ref]
    Vern Guest

Similar Threads

  1. action script execution order
    By danpojack webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 4
    Last Post: January 29th, 01:31 PM
  2. Execution order of AS on different layers
    By Batlock webforumsuser@macromedia.com in forum Macromedia Flash Actionscript
    Replies: 7
    Last Post: January 21st, 09:49 AM
  3. suspect on sp execution order
    By DIEGO BUENDIA in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 7th, 01:32 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139