You are viewing a single comment's thread from:
RE: Use Triggers Or Not In SQL Server?
There are several uses for triggers in SQL Server, including the following:
- Performing additional checks on the affected table while performing insert, update, or delete actions.
- They allow users to encode sophisticated default values that default constraints can't handle.
- All databases must have referential integrity.
- If you have a view that uses many tables, you may use these controls to fine-tune what happens when you conduct an insert, update, or delete operation.
- The use of triggers allows you to create a table with aggregated columns that you may manipulate.
- Using triggers in auditing and enforcing business rules is the best option. It is possible to keep track of table modifications by creating an audit log record that contains information about the user who made the change and what was modified using a trigger.
You can also use a stored procedure, but if you do so, you won't be able to log changes that were made directly to the database. It is worth mentioning that a helpful SQL Manager will automate a lot of processes.