Search

Monday, February 6, 2012

Find TCPIP Port

Use below script to find TCPIP Port on which SQL Server is listening:



DECLARE @key VARCHAR(50), @RegistryPath VARCHAR(200)
IF (SERVERPROPERTY('ArunL')) IS NULL
BEGIN
SET @RegistryPath='Software\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib\Tcp'
END
ELSE
BEGIN
SET @RegistryPath='Software\Microsoft\Microsoft SQL Server'+CONVERT(VARCHAR(25),SERVERPROPERTY('INSTANCENAME')) + '\MSSQLServer\SuperSocketNetLib\Tcp'
END
EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE', @RegistryPath, 'tcpPort'



No comments:

Post a Comment