Roger Alcindor
asked on
update trigger for single record
Is there any way that I can restrict the application of an update trigger to the record that has been updated and not each record in the whole table ?
I am concerned that when the table grows to a large size then the trigger will be wasting time by checking each record in the table when I only require the record that has just been updated to be acted upon by the update trigger.
The trigger checkes some other fields in the same table and updates a field in the dsame table
Thanks,
Roger
I am concerned that when the table grows to a large size then the trigger will be wasting time by checking each record in the table when I only require the record that has just been updated to be acted upon by the update trigger.
The trigger checkes some other fields in the same table and updates a field in the dsame table
Thanks,
Roger
yes you can do something like this
Create trigger yourtrname
for update
as
if update(yourfield)
begin
yourcode
end
Create trigger yourtrname
for update
as
if update(yourfield)
begin
yourcode
end
> Is there any way that I can restrict the application of an update trigger to the record that has been updated
Use inserted and/or deleted system tables. inserted table contains records being updated with new value, while deleted table contains records being updated with old value.
Use inserted and/or deleted system tables. inserted table contains records being updated with new value, while deleted table contains records being updated with old value.
ASKER
The if update(yourfield) answer is not what I am looking for.
It sounds like the inserted/deleted tables may be the answer but I can't find the tables on my server ?
Are they only visible during a trigger event ?
Roger
It sounds like the inserted/deleted tables may be the answer but I can't find the tables on my server ?
Are they only visible during a trigger event ?
Roger
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check Books online for more information!
Good luck!