damixa
asked on
trigger to populate username field in sql server
I need to create a trigger that populates a field named "CreatedBy" with the username of the person who creates the record. I already have a trigger that creates an audit log of when it was cretated like:
thanks
ALTER TRIGGER [dbo].[trg_CreatedDate]
ON dbo.mytable
AFTER Insert
AS
UPDATE dbo.mytable
SET CreatedDate = GETDATE()
WHERE ID IN (SELECT DISTINCT ID FROM Inserted)
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER