October 17, 2007 at 8:11 am
Is there a way to get the computer name from pc that is accessing a sql db. I know how to get user is there something similar for computer name?
thanks,
vmon
October 17, 2007 at 8:24 am
Hi vmon,
yes, have a look at sys.dm_exec_sessions and in there the host_name column.
Regards,
Andras
October 17, 2007 at 8:26 am
Just to add, for your current session you can do:
SELECT host_name
FROM sys.dm_exec_sessions
WHERE session_id = @@SPID
Regards,
Andras
October 17, 2007 at 8:32 am
Great! Thanks a bundle.
vmon
October 17, 2007 at 9:15 am
There is a system function to get it for the current connection:
select host_name()
Keep in mind that this value is completely configurable in your connection string. So, if the programmer (or the user if they can access the connection string for an application) sets the host name in the connection string to something else, that is what will be returned.
October 17, 2007 at 11:42 am
Note that those values are populated at will by the client application ( in the connection string )
* Noel
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply