I have a trigger
which deals with some data for logging purposes like so:
CREATE TRIGGER trgDataUpdated
ON tblData FOR UPDATE
AS
BEGIN
INSERT INTO tblLog ( ParentID, OldValue, NewValue, UserID )
SELECT deleted.ParentID, deleted.Value, inserted.Value,
@intUserID -- how can I pass this in?
FROM inserted INNER JOIN deleted ON inserted.ID = deleted.ID
END
How can I pass in the variable @intUserID
into the above trigger, as in the following code:
DECLARE @intUserID int
SET @intUserID = 10
UPDATE tblData
SET Value = @x
PS: I know I can't literally pass in @intUserID
to the trigger, it was just used for illustration purposes.