Labels

Friday, 13 September 2019

How many max connections does SQL Server allows.




To find this information we can use @@MAX_CONNECTIONS global variable.

@@MAX_CONNECTIONS in SQL Server returns maximum number of simultaneous user connections allowed. Maximum user connections allowed by SQL Server by default is 32,767; this number also depends on application and server hardware limits. This cam also be configured at server-level to avoid too many connections.
@@CONNECTIONS returns number of connection attempts (successful/failed) made to SQL Server since SQL Server is started. Since this include all attempts it can be greater than @@MAX_CONNECTIONS.

SELECT [ConnectionAttempts] = @@CONNECTIONS
        ,[MaximumAllowed] = @@MAX_CONNECTIONS

Tuesday, 10 September 2019

SQL Server - How to find domain name of SQL Instance installed using SQL query

The below script is very useful to find the domain details of SQL Instance installed 
specially if you don't have access to RDP the server.

DECLARE @Domain VARCHAR(100)
 ,@key VARCHAR(100)

SET @key = 'SYSTEM\ControlSet001\Services\Tcpip\Parameters\'

EXEC master..xp_regread @rootkey = 'HKEY_LOCAL_MACHINE'
 ,@key = @key
 ,@value_name = 'Domain'
 ,@value = @Domain OUTPUT

SELECT @@servername [SQL Instance Name]
 ,convert(VARCHAR(100), @Domain) AS [DomainName]
 ,'10.170.201.206' IPAddress