Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
From the current connection, without any special rights, get client and host information including connection protocol and addresses
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,
HOST_NAME() AS client_hostname,
SUSER_NAME() LoggedInUser,
@@servername AS 'ServerName\InstanceName',
SERVERPROPERTY('ServerName') AS 'ServerName',
SERVERPROPERTY('MachineName') AS 'Windows_MachineName',
SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS 'NetBIOS_Name',
SERVERPROPERTY('instanceName') AS 'InstanceName',
SERVERPROPERTY('IsClustered') AS 'IsClustered',
SERVERPROPERTY('Edition') AS 'Edition',
@@Version as 'Full_Server_Version'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment