Home Dashboard Directory Help
Search

Getting Windows Logged In UserName In SQL Server by Gnanavel Kesavan


Status: 

Closed


1
0
Sign in
to vote
Type: Suggestion
ID: 785988
Opened: 5/1/2013 6:36:31 AM
Access Restriction: Public
0
Workaround(s)
view

Description

It will be very useful if we get the windows logged in username through SQL server objects to track the user logs. We are getting displayed the user logged in SQL server. However it is required to display the windows logged in user name
Details
Sign in to post a comment.
Posted by Microsoft on 7/2/2013 at 4:26 PM
Hello Gnanavel. The support document related to this can be found here: http://msdn.microsoft.com/en-us/library/ff714019.aspx

Please let us know if this does not help.

-Walter A Jokiel, Program Manager, SQL Server (wajokiel@microsoft.com)
Posted by Gnanavel Kesavan on 6/28/2013 at 4:12 AM
Dear Walter,

Thanks for the update. Anyways please let me know from which transaction table I can get the data.. otherwise please look into this item and provide a solution.
Posted by Microsoft on 6/25/2013 at 9:59 AM
Hello, Gnanavel. For the information you want, for changes, you should be able to check the transaction table. This does not record reads, however. If this is insufficient, please let us know and we'll take another look at this item. Otherwise, we'll be closing as "by design."

-Walter A Jokiel, Program Manager, SQL Server (wajokiel@microsoft.com)
Posted by Gnanavel Kesavan on 5/29/2013 at 2:12 AM
Do we have any function to return the windows logged user name even if the user logged in SQL server with SQL authentication
Posted by Gnanavel Kesavan on 5/21/2013 at 6:05 AM
Hi Andrew,

Any update for my query and will be taken as a suggestion. Even if I change the auth methods, I should get the windows logged user name.
Posted by Gnanavel Kesavan on 5/7/2013 at 1:29 AM
Yes, the suser_name() will display the windows logged in id when the SQL server is connected using windows authentication . Can it be taken as a suggestion to display the username even the user logged in with SQL authentication. If it was not implemented earlier, please take it as a suggestion.

It will be useful for SQL administration.
Posted by AndrewTuerk on 5/6/2013 at 7:53 AM
Ah, so you are using SQL Auth and not Windows Auth to connect to your SQL Server. If you were to switch to Windows Auth suser_name() would get you what you want, although I cant speak to whether you can change auth methods.
Posted by Gnanavel Kesavan on 5/2/2013 at 7:54 AM
I am unable to upload, since the select button is not working.. Actually my windows user name is 'Gnanavel' and my sql server loggin user name is 'epmo'. The result of suser_name() displays 'epmo', which means not displaying the windows logged in user name.
Posted by Gnanavel Kesavan on 5/2/2013 at 5:11 AM
I am not able to upload the attachment. Please provide your email id.. will share the screen shot of my windows logged in user name and sql server user name.. The suser_name() resulted in sql server logged in username.
Posted by Gnanavel Kesavan on 5/2/2013 at 4:58 AM
Suser_name() gives the sql server login user name. I am expecting the windows os logged user name.
Posted by AndrewTuerk on 5/1/2013 at 8:34 AM
you can get the windows logged in user with suser_name() - are you looking for something different?
Sign in to post a workaround.