Using a Single Trigger for Insert and Update
I have been trying to handle Insert and Update using one trigger. Does anydody know how to detect that a row is being updated in SQL Server 2005? Thanks.
William.
Networks
I have been trying to handle Insert and Update using one trigger. Does anydody know how to detect that a row is being updated in SQL Server 2005? Thanks.
William.
if you have common code to run for both transactions put it in a stored proc and the call it from trigger for update and trigger for insert.
The other way is to make use of the inserted and deleted tables. on an insert, the deleted table will be empty.
by wcovuaku
by pettis1
Link for an example of how to use it.
This discussion is closed to new replies.
Sort by Trending