Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating a simple trigger

Participant ,
Sep 10, 2008 Sep 10, 2008
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 🙂
TOPICS
Database access
397
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 10, 2008 Sep 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 ...".
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 13, 2008 Sep 13, 2008
LATEST
How bout just simply using the cfqueryparam tag?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources