SQL Server Triggers

SQL Server Triggers

Post by Amudha Uda » Thu, 15 May 2003 01:31:28



Hi,
I have created a "Status Change Email" trigger on
a "Projects" table in SQL Server Enterprise Manager that
would  automatically fire a trigger when someone changes
the "Status" field's value in the "Projects" table. I
have an "ModifiedBy " field in the same Projects table
that would fetch the value from Current User Name (To
know who actually made the change).
I have made the default value for "ModifiedBy" field in
the "Projects" table on SQL Server as "(user_name())".

When I go back and make changes to the Status field in
the "Projects" form record, and move to the next record
the email is triggerd. I get a email messagew with
the "ModifiedBy" value as "dbo" instead of the user name.

The code doesn't pick up the current user name. Can you
please help me with troubleshooting the following error.

Thanks
AmudhaUday