Results 1 to 2 of 2

Thread: Query

  1. #1
    Join Date
    Oct 2008
    Posts
    1

    Unanswered: Query

    Hi All,

    Do you know the query in TSQL to find out the port number in which SQL server is running?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I think you'll have to resort to reading from the registry, here's a snippet I discovered.
    Code:
    DECLARE @tcp_port nvarchar(5)
    
    EXEC xp_regread
    @rootkey    =    ‘HKEY_LOCAL_MACHINE’,
    @key        =    ‘SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP’,
    @value_name    =    ‘TcpPort’,
    @value        =    @tcp_port OUTPUT
    
    select @tcp_port
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •