Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 2.28 KB

connections-transact-sql.md

File metadata and controls

65 lines (50 loc) · 2.28 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
@@CONNECTIONS (Transact-SQL)
@@CONNECTIONS (Transact-SQL)
markingmyname
maghan
09/18/2017
sql
t-sql
reference
@@CONNECTIONS
@@CONNECTIONS_TSQL
@@CONNECTIONS function
connections [SQL Server], number of
connections [SQL Server], attempted
number of connection attempts
attempted connections
TSQL

@@CONNECTIONS (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Managed Instance]

This function returns the number of attempted connections - both successful and unsuccessful - since [!INCLUDEssNoVersion] was last started.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

@@CONNECTIONS  

Return types

integer

Remarks

Connections are different from users. An application, for example, can open multiple connections to [!INCLUDEssNoVersion] without user observation of those connections.

Run sp_monitor for a report containing several [!INCLUDEssNoVersion] 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';  

[!INCLUDEssResult]

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)