I'm new to DBA and I'm attempting to create a trigger that will update the a specified column in one table whenever an insert is made into every table across the database.
I understand it is possible to implement many triggers to solve this problem however it seems to me that it would be much more maintainable if it were to be a single trigger activating at a database wide level.
If having a single trigger is possible, is there then also reason I should not have one trigger to manage all of the tables?
Below is the current way in which I would implement the triggers at a table by table basis:
CREATE TRIGGER [dac].[T_UpdateModelTime] ON [dac].[SubSpeciality] AFTER INSERT AS DECLARE @Table_Model_ID int SELECT @Table_Model_ID = Model_ID FROM SubSpeciality UPDATE ModelVersion SET DateLastEdited = GETDATE() WHERE ID = @Table_Model_ID; GO
The data is inserted into the tables through stored procedures.
The updated column requires time sensitivity within seconds.