Skip to main content
Inspiring
September 10, 2008
Question

Creating a simple trigger

  • September 10, 2008
  • 2 replies
  • 432 views
Can someone help me with an example piece of code that demonstrates how to write a trigger in MSSQL that prevents deletions without a WHERE clause?

Thanks 🙂
This topic has been closed for replies.

2 replies

Inspiring
September 13, 2008
How bout just simply using the cfqueryparam tag?
Inspiring
September 10, 2008
I do not think a trigger can detect the where clause used. If you mean prevent someone from deleting all records in a table, you might try an INSTEAD OF trigger. One approach would be to check the number of records that were deleted against the number of records in the table. If they are equal, raise an error "Sorry. You cannot delete all records in this table ...".