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. trigger after delete

trigger after delete

Scheduled Pinned Locked Moved Database
databasexml
5 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.
  • H Offline
    H Offline
    haytham_mohammad
    wrote on last edited by
    #1

    hi every body I have a table called "fields" i want to make a trigger that work after any deletion from "fields" table then insert the deleted row into another table called "fields_history" ! Assume that both tables have the same schema. thanks in advance. Kind Regards.

    haitham

    P 1 Reply Last reply
    0
    • H haytham_mohammad

      hi every body I have a table called "fields" i want to make a trigger that work after any deletion from "fields" table then insert the deleted row into another table called "fields_history" ! Assume that both tables have the same schema. thanks in advance. Kind Regards.

      haitham

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      What is your question? You want to write a delete trigger but don't know how? Have you tried reading the documentation[^]?

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      H 1 Reply Last reply
      0
      • P pmarfleet

        What is your question? You want to write a delete trigger but don't know how? Have you tried reading the documentation[^]?

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        H Offline
        H Offline
        haytham_mohammad
        wrote on last edited by
        #3

        thanks for ur attention i know the syntax of how to write a trigger but i want to take the row that is deleted from the first table and insert that row in the second table thank you in advance.

        haitham

        P 1 Reply Last reply
        0
        • H haytham_mohammad

          thanks for ur attention i know the syntax of how to write a trigger but i want to take the row that is deleted from the first table and insert that row in the second table thank you in advance.

          haitham

          P Offline
          P Offline
          pmarfleet
          wrote on last edited by
          #4

          The logical table deleted contains the data for the row(s) you are deleting. Write an INSERT INTO query that takes the rows in this table and inserts them into your history table.

          Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

          H 1 Reply Last reply
          0
          • P pmarfleet

            The logical table deleted contains the data for the row(s) you are deleting. Write an INSERT INTO query that takes the rows in this table and inserts them into your history table.

            Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

            H Offline
            H Offline
            haytham_mohammad
            wrote on last edited by
            #5

            thank you very much for this help

            haitham

            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