How to port no on Sql server

  • Can any one know where to find port id in sql server.

    I am new to sql server dba ...please help.

    Thanks & Regards

    shiva

    Regards,
    SAM
    ***Share your knowledge.It’s a way to achieve immortality----Dalai Lama***

  • http://stackoverflow.com/questions/1518823/how-to-find-the-port-for-ms-sql-server-2008

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • thanks a lot

    Regards,
    SAM
    ***Share your knowledge.It’s a way to achieve immortality----Dalai Lama***

  • Below are the methods to find the Port of SQL Server

    1) From the errorlog. I.e sp_readerrorlog

    2) From the Client protocols of configuration manager.

    Thanks,
    I’m nobody but still I’m somebody to someone………….

  • samking (9/18/2013)


    Can any one know where to find port id in sql server.

    I am new to sql server dba ...please help.

    Thanks & Regards

    shiva

    The following query will return the instance and the port number it's listening on:

    DECLARE @TcpPort VARCHAR(5)

            ,@RegKey VARCHAR(100)

     

    IF @@SERVICENAME !='MSSQLSERVER'

        BEGIN

            SET @RegKey = 'SOFTWARE\Microsoft\Microsoft SQL Server\' + @@SERVICENAME + '\MSSQLServer\SuperSocketNetLib\Tcp'

        END

        ELSE

        BEGIN

            SET @RegKey = 'SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP'

        END

     

    EXEC master..xp_regread

        @rootkey = 'HKEY_LOCAL_MACHINE'

        ,@key = @RegKey

        ,@value_name = 'TcpPort'

        ,@value = @TcpPort OUTPUT

     

    SELECT @TcpPort AS PortNumber

            ,@@SERVERNAME AS ServerName

            ,@@SERVICENAME AS ServiceName

    [font="Times New Roman"]There's no kill switch on awesome![/font]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply