You might need to know the IP Address and the TCP Port of the currently connected SQL Server; this simple SQL Script will help you to find the Server IP Address. This script only works for connections that are using the TCP/IP protocol.
(Note: this script only works on or above SQL 2008 version)
1 2 3 4 5 |
SELECT SERVERPROPERTY(N'MachineName') AS [Server Name], @@SERVERNAME AS [SQL Server Instance], CONNECTIONPROPERTY('local_net_address') AS [Server IP Address], CONNECTIONPROPERTY('local_tcp_port') AS [Server TCP Port] |
Leave a Comment