@@CONNECTIONS and @@MAX_CONNECTIONS | SansSQL

Monday, December 29, 2008

@@CONNECTIONS and @@MAX_CONNECTIONS

@@CONNECTIONS returns the number of attempted connections, either successful or unsuccessful since SQL Server was last started.Connections are different from users. For example, Applications can open multiple connections to SQL Server without the user observing the connections.
Syntax: - Select @@CONNECTIONS
@@MAX_CONNECTIONS is the maximum number of connections allowed simultaneously to the SQL server. The number returned is not necessarily the number currently configured. The actual number of user connections allowed also depends on the version of SQL Server installed and the limitations of your applications and hardware.
To Change the max connections, Use sp_configure
Syntax: - Select @@MAX_CONNECTIONS
@@CONNECTIONS is incremented with each login attempt, therefore @@CONNECTIONS can be greater than @@MAX_CONNECTIONS.
 
Example: -
SELECT GETDATE() AS 'Current Date and Time',
@@CONNECTIONS AS 'Login Attempts',
@@MAX_CONNECTIONS AS 'Max Connections Allowed'

2 comments:

ashish malwal said...

Its reallly Awsum!!!! bhai..

ashish malwal said...

Hi i have a question is 32767 is the maximum size of user allowed in sql server its same in all sql server version or every edition contain different number.

Post a Comment