Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 How to find an instance TCP/IP Port

Author  Topic 

TimS
Posting Yak Master

198 Posts

Posted - 2006-02-17 : 13:29:38
BEGIN

DECLARE
@df nvarchar(64),
@key nvarchar(256),
@instance nvarchar(64)

SET @instance = CAST(SERVERPROPERTY ( 'InstanceName' ) AS nvarchar(64))

IF @instance IS NOT NULL
SET @key = N'SOFTWARE\Microsoft\Microsoft SQL Server\' + @instance +
N'\MSSQLServer\SuperSocketNetLib\Tcp'
ELSE
SET @key = N'SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib\Tcp'

EXEC master.dbo.xp_regread
N'HKEY_LOCAL_MACHINE',
@key,
N'TcpPort',
@df OUTPUT,
N'no_output'

SELECT @df AS "TCP/IP Port"

END

Tim S
   

- Advertisement -