Professional Web Applications Themes

Modify updated data in a trigger? - Microsoft SQL / MS SQL Server

Bill You didn't say what version you were using. Please note that 'INSTEAD OF' triggers are only available in SQL Server 2000. Also, to add to what Amy said, they don't actually fire before the fact; as the name implies, they fire INSTEAD OF doing the action. So if you have an INSTEAD OF UPDATE trigger, the trigger will fire, and the update will not happen, unless the trigger code includes the same update code. There are examples of both types in the Books Online. -- HTH ---------------- Kalen Delaney SQL Server MVP www.SolidQualityLearning.com "Amy" <com> wrote in message news:u9$phx.gbl...  ...

  1. #1

    Default Re: Modify updated data in a trigger?

    Bill

    You didn't say what version you were using. Please note that 'INSTEAD OF'
    triggers are only available in SQL Server 2000.

    Also, to add to what Amy said, they don't actually fire before the fact; as
    the name implies, they fire INSTEAD OF doing the action. So if you have an
    INSTEAD OF UPDATE trigger, the trigger will fire, and the update will not
    happen, unless the trigger code includes the same update code. There are
    examples of both types in the Books Online.

    --
    HTH
    ----------------
    Kalen Delaney
    SQL Server MVP
    www.SolidQualityLearning.com


    "Amy" <com> wrote in message
    news:u9$phx.gbl... 
    'AFTER 
    >
    >[/ref]


    Kalen Guest

  2. #2

    Default Re: Modify updated data in a trigger?

    INSTEAD OF triggers, introduced in SQL 2000, allow you to perform the
    update within your trigger code using the inserted and deleted tables.
    No update of the underlying tables will occur before or after the
    trigger is fires so you'll need to handle all necessary processing in
    your trigger code.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    -----------------------
    SQL FAQ links (courtesy Neil Pike):

    http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
    http://www.sqlserverfaq.com
    http://www.mssqlserver.com/faq
    -----------------------

    "Bill Todd" <com> wrote in message
    news:com... 


    Dan Guest

  3. #3

    Default Re: Modify updated data in a trigger?

    Hi Bill,

    There are 2 types of TRIGGERS.
    The default (if you create the trigger with the FOR UPDATE syntax) is 'AFTER
    TRIGGER' which fires 'after the fact'.
    You could create 'INSTEAD OF' trigger which will fire 'before the fact'.

    Look for 'CREATE TRIGGER' in BOL.

    HTH

    "Bill Todd" <com> wrote in message
    news:com... 


    Amy Guest

Similar Threads

  1. ASP does not provide updated data from access ?
    By judo4 in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: December 22nd, 10:18 PM
  2. Retrieving Updated Data
    By Roshawn in forum ASP.NET Web Services
    Replies: 2
    Last Post: July 28th, 04:15 AM
  3. Trigger to update another data source
    By Mandar Naik[MSFT] in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 30th, 09:20 AM

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