Getting current connection properties in SQL Server

sql server connection properties
how to check sql server configuration
sql server jdbc connection properties
sql server connection string
sql server configuration settings
sql server show connections to database
how to get connection string from sql server
monitor sql server connections

In MS SQL Server, the Database Properties dialog has the "View Connection Properties" link over on the left. Clicking that brings the "Connection Properties" dialog with properties of the current connection, such as Authentication Method, Network Protocol, Computer Name, etc...

Is there a way to get that information programmatically by running a sql query? What would that query look like?


SQL 2005 and after you interrogate sys.dm_exec_connections. To retrieve your current connection properties you'd run:

select * from sys.dm_exec_connections
where session_id = @@SPID

The field values depend on the protocol used to connect (shared memory, named pipes or tcp) but all contain information about authentication method used, protocol and client net address.

How do I see active SQL Server connections?, if those sessions are doing any I/O and there is an option to kill them. The simplest way to download the library and its dependencies is using Maven: First, install Maven on your system. Go to the GitHub page of the driver. Download the pom.xml file. Run the following Maven command to download the library and its dependencies: mvn dependency:copy-dependencies.


Yes you can, but it depends on which property you are after as the ones displayed in the connection properties UI come from several places.

It uses several queries (such as xp_msver and select suser_sname()) to get hold of some properties, but it also uses the xp_instance_regread stored procedure to get hold of some values from the registry of the server.

Pretty much everything that is done is management studio when interacting with the SQL engine can be done using SQL. Starting a profiler session and doing the actions in the UI will uncover what (sometimes obscure/undocumented/unsupported) SQL is being run.

Connection Properties Dialog Box, View or Change Server Properties (SQL Server) must open another connection to the same instance that is used by the current connection. In SQL Server Configuration Manager, click SQL Server Services. In the details pane, right-click SQL Server (< instancename >) , and then click Properties . In the SQL Server (< instancename >) Properties dialog box, change the server properties on the Service tab or the Advanced tab, and then click OK .


I think the answer is 'no'. Computer information is stored on the computer. Connection information is most likely stored in a configuraton file or in MS SQL Server.

But have a look at the MSSQL system tables and see what properties they have.

View or Change Server Properties (SQL Server), The following table lists all the currently available connection string properties for the JDBC driver. Table 1. Property Type Default, Description  Dear Sir, I want to get all properties of current connection in sql server 2005 using sql command not winzard but how to get it. please help me


From client tool perspective you could use CONNECTIONPROPERTY:

For a request that comes in to the server, this function returns information about the connection properties of the unique connection which supports that request.

 SELECT ConnectionProperty('net_transport') AS [Net transport],   
        ConnectionProperty('protocol_type') AS [Protocol type];  

DBFiddle Demo

Setting the connection properties, Use this tab to view or specify options when connecting to an instance of Microsoft SQL Server Database Engine or registering Database  The name or network address of the instance of SQL Server to which to connect. The port number can be specified after the server name: server=tcp:servername, portnumber. When specifying a local instance, always use (local). To force a protocol, add one of the following prefixes: np:(local), tcp:(local),


Connect to Server (Connection Properties Page) Database Engine , In Object Explorer, connect to an instance of the SQL Server (Transact-SQL) catalog view to view several properties of the current database. SQL Server offers many built in metadata functions and one of these functions, @@OPTIONS which allows you to get the current values that are set for the current session. When each connection is made the default values are established for each connection and remain set unless they are overridden by some other process.


View or Change the Properties of a Database, Use sys.dm_exec_sessions to first view the current system load and to identify a session of A. Finding users that are connected to the server. In SQL Server Configuration Manager, in the console pane, expand SQL Server Network Configuration, expand Protocols for <instance name> , and then double-click TCP/IP. In the TCP/IP Properties dialog box, on the IP Addresses tab, several IP addresses appear in the format IP1, IP2, up to IPAll.


sys.dm_exec_sessions (Transact-SQL), If they have not, the instance of SQL Server must be restarted first. Running Values View the currently running values for the options on this pane. SERVERPROPERTY is a system defined function that helps get property information about the current server instance. In SQL Server 2016, eight new properties were added to the SERVERPROPERTY system function that provides us with more information about the current SQL Server instance version, build and other useful information.