How to find SQL Server Port Number using SQL Server Management Studio - SQL Server DBA Tutorial

This video illustrates following:

1- How to find SQL Server Port number using SQL Server Management Studio (SSMS)
2- How to find Default and named instances of SQL Server Port using Regedit
3- How to read values from registry related to SQL Server
4- How to find SQL Server Port Number using T-SQL Script

Script to get Port Number for SQL Server Instance

DECLARE @PortNumber VARCHAR(10), @KeyValue VARCHAR(100)
IF CHARINDEX('\',@@SERVERNAME,0) <>0
BEGIN
SET @KeyValue = 'SOFTWARE\MICROSOFT\Microsoft SQL Server\'+@@SERVICENAME+'\MSSQLServer\Supersocketnetlib\TCP'
END
ELSE
BEGIN
SET @keyValue = 'SOFTWARE\MICROSOFT\MSSQLServer\MSSQLServer \Supersocketnetlib\TCP'
END
--How to read Registry in T-SQL Terms - ROOTKEY, KEY, VALUENAME,VALUE 
EXEC master..xp_regread 'HKEY_LOCAL_MACHINE',@KeyValue,'Tcpport',@value=@PortNumber OUTPUT


SELECT 'SQLSERVER_NAME: '+@@SERVERNAME + ' : SQL SERVER Port Number:'+CONVERT(VARCHAR(10),
@PortNumber)


Get SQL Server Port Number using SQL Server Management Studio - SQL Server DBA Tutorial

3 comments:

  1. Could you please help me on this topic
    https://stackoverflow.com/questions/68462343/i-cant-access-mssql-server-remotely

    I'll PAY you if you could help me.
    kindly reply to Quhtani@gmail.com

    ReplyDelete
  2. If you struggle with finding the best solution for your project, it would be better for you to contact specialists, they can help you with that. In my case, professionals from https://processmix.com/solutions/build-api/ provided me with all the necessary services, and it wasn't a problem for me to optimize business processes and improve the development speed.

    ReplyDelete
  3. Have you ever used QuickBooks by Intuit? It is a lifesaver for small businesses. It has everything you need for accounting. I especially like quickbooks intuit because everything is automated: synchronization with the bank, invoices and reports, everything is done quickly and without errors. In addition, the interface is super simple, even if you are not an accountant. Before, I spent a lot of time on calculations, and now I can focus on other things.

    ReplyDelete