That trigger would look something like this.
<pre>
CREATE TRIGGER t_YourTable_u on dbo.YourTable
FOR UPDATE
AS
UPDATE YourTable
SET UserName = suser_sname(),
DateChanged = getdate()
FROM inserted
WHERE inserted.PK_Column = YourTable.PK_Column</pre>
Table and column names will need to be changed to match your table and column names.
The table inserted is a virtual table who’s name can not be changed.
Discuss This Question: