December 11, 2008 at 6:12 am
hi,
is there any way in sql server 2005 to retrieve domain user name while logged on using SQL Server authentication to sql server.
I know that computer name can be retrieved using the function host_name(), is there any built in function to retrieve DOMAIN\username logged to that computer?
the function SUSER_SNAME() retrieves only sqluser name when logged using sql auth.
any idea?
thanks,
Behar
December 11, 2008 at 7:49 am
Are you asking how to grab your own Domain name, or other users?
If you're logged in as SQL authentication mode, I don't see how it call your domain info
If I'm logged in using Windows Authentication, SELECT SUSER_NAME() correctly returns my DOMAIN\user info
while USER_NAME() returns my Schema (dbo)
December 11, 2008 at 8:25 am
yes, thats correct.
but what i'm asking is, when you are accessing sql server using sql server authentication. how to retrive domain user name which is logged on windows.
lets say, we have an application which connects to sql server using only one sql user and you want to be able to audit record deletions in a table, so you want to know which domain user was using the application at the time of the deletion of the record.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply