April 14, 2005 at 5:31 am
The trigger below puts the dbo id in the User_name1 field when Day1 is updated. How can I get it to put the user NT login id (rather) in the User_name1 field?
CREATE TRIGGER [track_time] ON dbo.FromTrainersTable
FOR UPDATE
AS
UPDATE FromTrainersTable
SET timestamp1=GETDATE() , User_name1=USER
FROM FromTrainersTable
JOIN deleted ON FromTrainersTable.FTKey=deleted.FTkey
AND FromTrainersTable.Day1<>deleted.Day1
April 14, 2005 at 5:54 am
Use SUSER_SNAME() instead of USER
April 14, 2005 at 6:45 am
Hi Chris,
I have implemented your suggestion and changed the User to SUSER_SNAME() but it still returns eut2 on any pc. Anything more I can do?
April 14, 2005 at 6:55 am
SUSER_SNAME() returns the name of the login that the user is connected to the database with. If you are using SQL Server authentication it will return the SQL Server login name, which I assume is eut2 in your case. I do not know of any way to get the NT user name the user is running as on the client, which I assume is what you are looking for.
April 15, 2005 at 6:38 am
The SQL Query analyzer is able to display my NT login id.
Why isn't it possible to pass this id to a trigger? Wake up guys.
April 15, 2005 at 8:20 am
Where do you mean it is displayed?
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply