Table can have trigger on insert/delete/update. Trigger will be fired internally by DB engine.
Is it possible to pass a parameter to trigger in SQL Server database like a stored procedure?
you can't pass a variable into a trigger. the only way to get the information in the trigger is to be able to SELECT it based on the INSERTED or DELETED tables or add a column onto the affected table and put the value in that column.
We can also pass dates as parameters in the SQL Server functions. In this section, we will create a function that will take a particular date as the input parameter.
Since triggers execute as part of a transaction, the following statements are not allowed in a trigger: All create commands, including create database, create table, create index, create procedure, create default, create rule, create trigger, and create view. All drop commands. alter table and alter database.
A) Yes they can, we're talking about nested triggers.
Indirectly via CONTEXT_INFO()
. See Using Session Context Information. The fact that your trigger needs extra state is always a code smell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With