SELECT CONNECTIONPROPERTY('net_transport') AS net_transport, CONNECTIONPROPERTY('protocol_type') AS protocol_type, CONNECTIONPROPERTY('auth_scheme') AS auth_scheme, CONNECTIONPROPERTY('local_net_address') AS local_net_address, CONNECTIONPROPERTY('local_tcp_port') AS local_tcp_port, CONNECTIONPROPERTY('client_net_address') AS client_net_address
The code here will give you an IP address;
This will work for remote client query on SQL 2008 and newer.
If you use Permissions for shared memory, then doing the above on the server itself will give you
- Shared memory as the value for net_transport and
- NULL for 'local_net_address' and
- '
<local machine> ' will be displayed in 'client_net_address'.
"client_net_address" is the address of the computer to which the request was sent, while "local_net_address" will be the SQL server (thus NULL over shared memory connections) and the address you would give someone if they cannot use the server name NetBios or FQDN for any reason.
I highly recommend using this answer . Enabling the shell is a very bad idea on production SQL Server.
Jeff Muzzy Feb 04 '13 at 20:59 2013-02-04 20:59
source share