September 16, 2011 at 8:55 am
Hello everyone.
Is it possible to retrieve a Windows network name while logged into SQL Server using the sa account? I've tried every function in BOL related to security, but the ones I thought would work only returned "sa" instead of the network name of the current machine. Any ideas?
Thanks.
September 16, 2011 at 9:10 am
Yes, its possible. Try suser_name() instead of user_name.
Example:
select
user_name() [user_name]
,suser_name() [suser_name]
Steve
http://stevefibich.net
http://utilitydb.codeplex.com/
September 16, 2011 at 9:28 am
however, if htey connected using a SQL login, the windows username is not available in any way, shape or form, unless you specifically code an application to get the information and pass it along.
SQL logins do not contain any info from Windows.
Lowell
September 16, 2011 at 10:53 am
I was afraid that would be the case.
Thanks.
September 17, 2011 at 4:42 pm
NO you can't get that info for SQL Server logins..
Thank You,
Best Regards,
SQLBuddy
September 18, 2011 at 9:52 am
you should be able to get the IP address of the client this may help to narrow the user down
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
September 19, 2011 at 1:44 pm
Perry Whittle (9/18/2011)
you should be able to get the IP address of the client this may help to narrow the user down
Ya, I bust people for using an sql account by getting the host name which is assigned to a particular user where I work.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply