Check the SQL error log by using the below TSQL:
sp_readerrorlog 1, 1, 'listening', 'server'
Here is another method for default instance:
DECLARE @findport_number nvarchar(5)
EXEC xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP',
@value_name = 'TcpPort',
@value = @findport_number OUTPUT
print 'The server port number = '+@findport_number
No comments:
Post a Comment