SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SQL Server and T-SQL Development Tutorials
Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.




SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012



Find the Port Number for SQL Server Instance

Default port number for SQL Server connections is 1433. On the other hand, on purpose SQL Server administrators may change the default port number for their SQL Server instances. Or for cases where multiple SQL Server instances are installed on the same server, new instances will use different port numbers than the default port number 1433.

If you have problem to connect to a SQL Server instance using port number 1433, the cause can be the database instance could be using a different port number. To identify the port number on the current SQL Server instance, SQL developers can execute following SQL command.

declare @SQLServerPortNumber nvarchar(10);
exec xp_instance_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'Software\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp\IpAll',
@value_name = 'TcpDynamicPorts',
@value = @SQLServerPortNumber output;

select @SQLServerPortNumber as "Port Number"

SQL programmers can call xp_instance_regread extended stored procedure to read registry values. The registry key is 'Software\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp\IpAll' And the port number we are interested is stored in TcpDynamicPorts

As you can see below, my SQL Server instance (SQL Server 2019 CTP3) is using port number 63449 which is different than the default 1433 port number.

find port number of SQL Server instance by code






Related SQL Resources

SQL Server Articles

SQL Server 2012

SQL Server Tools

SQL Blog

MS SQL Server Forums






SQL Split String Related SQL Server Tutorials

Split String using XML - How to Convert or Split a Delimited String Values to Rows using T-SQL XML Commands
Split String Into Fixed Length Pieces in SQL
Recursive Function Sample - MS SQL Server Recursive T-SQL Split Function
TSQL Character Split Function in SQL Server
Case Sensitive SQL Split Function
SQL Server 2016 Split String Function STRING_SPLIT
SQL Server String Split T-SQL CLR Function Sample
SQL Server CLR Split String Function for 2-Dimensional Array
T-SQL Split User Defined Function


Copyright © 2004 - 2019 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems