June 24, 2003 at 5:55 pm
Ok, I think I may be stupid here but I nee a way to update two fields in a table, specifically a field that holds the date last updated and another that holds the username when the record was last updated. I have set constraints on the table to take care of the insert but I am lost when it comes to an update. Shall I use a INSTEAD_OF trigger and run my own update using the inserted table? I am thinking this must be done all the time.....
Thanks,
June 24, 2003 at 6:28 pm
create trigger mytrigger on mytable for update
as
update mytable
set lastuser = suser_sname()
, lasttime = getdate()
from inserted
where inserted.pk = mytable.pk
Steve Jones
June 25, 2003 at 1:27 am
What about the nested firing of triggers are on?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply