Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Trigger not working on update statement

SQL Trigger not working on update statement

Scheduled Pinned Locked Moved Database
databasehelpquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BSRK
    wrote on last edited by
    #1

    SQL Trigger not working on update statement hi i am having a table with 3 columns (a,b,c). i have written a trigger for INSERT / UPDATE as c=a+b this is working fine as long as i enter/update each row by row manually. but, when i use any update statement for a set of rows, the trigger is firing only for the last row. can anyone please help? Thanks

    D 1 Reply Last reply
    0
    • B BSRK

      SQL Trigger not working on update statement hi i am having a table with 3 columns (a,b,c). i have written a trigger for INSERT / UPDATE as c=a+b this is working fine as long as i enter/update each row by row manually. but, when i use any update statement for a set of rows, the trigger is firing only for the last row. can anyone please help? Thanks

      D Offline
      D Offline
      differenceengine
      wrote on last edited by
      #2

      Do you know that if an Update statement affects multiple rows, the trigger fires only once, and in the trigger you have to select from the virtual tables INSERTED and DELETED to get the copies of the affected rows.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups