Can I check if a variable was declared from inside a trigger?

Last Post 03 Sep 2008 11:24 AM by fcaserio. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
fcaserio
New Member
New Member

--
03 Sep 2008 11:24 AM
I want to run a script like this:

declare @user varchar(100)
set @user = 'application username'
update table ...

And my trigger should work like this:

CREATE TRIGGER MYTG on table
BEGIN
IF (is_declared(@user))
UPDATE table
INNER JOIN inserted ON
inserted.id = table.id
SET table.historico = table.historico + 'UPDATED ON ' + getdate() + ' BY ' + @user
WHERE table.id = inserted.id
END

Is it possible to read the @user variable from inside the trigger?
You are not authorized to post a reply.

Acceptable Use Policy