@@CONNECTIONS (Transact-SQL)
Applies to:
SQL Server
Azure SQL Managed Instance
This function returns the number of attempted connections - both successful and unsuccessful - since SQL Server was last started.
Transact-SQL syntax conventions
Syntax
@@CONNECTIONS
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Return types
integer
Remarks
Connections are different from users. An application, for example, can open multiple connections to SQL Server without user observation of those connections.
Run sp_monitor for a report containing several SQL Server statistics, including count of connection attempts.
@@MAX_CONNECTIONS is the maximum allowed number of simultaneous connections to the server. @@CONNECTIONS increments with each login attempt; therefore, @@CONNECTIONS can exceed @@MAX_CONNECTIONS.
Examples
This example returns the count of login attempts as of the current date and time.
SELECT GETDATE() AS 'Today''s Date and Time',
@@CONNECTIONS AS 'Login Attempts';
Here is the result set.
Today's Date and Time Login Attempts
---------------------- --------------
12/5/2006 10:32:45 AM 211023
See also
System Statistical Functions (Transact-SQL)
sp_monitor (Transact-SQL)
Visszajelzés
https://aka.ms/ContentUserFeedback.
Hamarosan elérhető: 2024-ben fokozatosan kivezetjük a GitHub-problémákat a tartalom visszajelzési mechanizmusaként, és lecseréljük egy új visszajelzési rendszerre. További információ:Visszajelzés küldése és megtekintése a következőhöz: