SQL Triggers Prevent Incorrect Postings
A while back, I discussed the use of triggers in SQL. There are many things that they can be used for. Here is and example of a simple but different use that paid off significantly for a customer.
Recently, I added triggers to a couple of tables for one of our customers, that block users from processing for the wrong store. This customer has several stores, and users move between them. One issue that was addressed by the trigger, was that there was a problem with users posting tickets at one store, when they were actually at another store.
A trigger was added to the first table that was updated. This trigger checked that the store being posted, is the store that user is logged in to. If it is not, then the trigger raises an error, and the posting procedure is stopped immediately. This stopped the cross-posting that had been occurring.
The more I work with SQL, the more uses I find for triggers, besides the usual use of automatically updating other tables.