SQL Server - How to get IP of your own server?

sql, sql-server

Solution

Try this one -

SELECT 
      client_net_address = CASE WHEN client_net_address = '<local machine>' 
                                THEN '127.0.0.1' 
                                ELSE client_net_address 
                           END  
    , local_net_address = ISNULL(local_net_address, '127.0.0.1')
    , server_name = @@SERVERNAME
    , machine_name = SERVERPROPERTY('MachineName')
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;

Problem

I saw that it is possible to connect to remote SQL servers by using their IP inside Manangement studio. Now I want to allow the database on my computer to be accessible remotely. How do I find out the IP of my own SQL server so that I can use that IP to login remotely ?

Original source