Instead of Delete Trigger

  • I have one 'instead of delete' trigger on one table, which I want to use to control what gets deleted on that table. When I delete records using a script e.g. "delete from MyTable where ID in (1, 2, 3)" the deleted virtual table inside the trigger contains three records. However, if I delete rows directly from the table view (using MS Server Management Studio Edit Rows view), the last record is always omitted from the deleted virtual table in the trigger. I appreciate that I should never delete directly from within a table view, but I want to understand why this would happen? It is always the last record that is missing, no matter how many I delete (unless I delete 1 record which is always included).

  • Yes, as you acknowledge, you never quite know what you're getting when you use the GUI, which is a good reason to shy away from it in many circumstances. Have you tried running a trace to find out what is actually happen when you do your delete?

    John

  • Not entirely sure how to set a trace? Could you point me in the right direction?

  • Have a look at this. Make sure you do this on a test server.

    John

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply