locked
Trigger to insert ONLY IF old data is not null? RRS feed

  • Question

  • User-1949910660 posted

     Hi, I am new to trigger. But I can't seem to be able to construct a good idea to form a trigger. Here is what I need to achieve.

    When a column (ie. Status) is updated in a table, I need to insert the table primary key into another table. However, I will only insert to another table IF the Status value is "null" BEFORE it's updated AND AFTER updated, the Status value is 1 (it will not insert to another table is new status value is > 1). How do I acheive it?

    Tuesday, March 31, 2009 9:46 AM

Answers

  • User1052258516 posted

    Triggers are usefull but if you are not familiar with them it might be wise to do all of the logic in a stored procedure.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 31, 2009 11:11 PM
  • User-1199946673 posted

    This is the Access Database And AccessDataSource Control forum. Access doesn't support triggers, so which database are you refering?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 1, 2009 7:43 AM

All replies

  • User1052258516 posted

    Triggers are usefull but if you are not familiar with them it might be wise to do all of the logic in a stored procedure.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 31, 2009 11:11 PM
  • User-1199946673 posted

    This is the Access Database And AccessDataSource Control forum. Access doesn't support triggers, so which database are you refering?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 1, 2009 7:43 AM