SQL SERVER – Two Connections Related Global Variables Explained – @@CONNECTIONS and @@MAX_CONNECTIONS

Few days ago, I was searching MSDN and I stumbled upon following two global variables. Following variables are very briefly explained in the BOL. I have taken their definition from BOL and modified BOL example to displayed both the global variable together.

@@CONNECTIONS
Returns the number of attempted connections, either successful or unsuccessful since SQL Server was last started.

@@MAX_CONNECTIONS
Returns the maximum number of simultaneous user connections allowed on an instance of SQL Server. The number returned is not necessarily the number currently configured.

@@MAX_CONNECTIONS is the maximum number of connections allowed simultaneously to the server. @@CONNECTIONS is incremented with each login attempt, therefore @@CONNECTIONS can be greater than @@MAX_CONNECTIONS.

Example:
SELECT GETDATE() AS 'Currunt Time',
@@CONNECTIONS AS 'Total Logins so far',
@@MAX_CONNECTIONS AS 'Max Connection Simultaneously'

Currunt Time Total Logins so far Max Connection Simultaneously
———————– ——————- —————————–
2007-09-03 17:28:12.013 71 32767

Reference : Pinal Dave (https://blog.sqlauthority.com)

SQL Function, SQL Scripts, SQL Transactions
Previous Post
SQL SERVER – Introduction and Example for DATEFORMAT Command
Next Post
SQL SERVER – 2005 Query Editor – Microsoft SQL Server Management Studio

Related Posts

Leave a Reply