mshakurov
mshakurov

Reputation: 84

SQL Server FileTable - IP Address instead of Host name

Is there any way to configure SQL Server so that the function FileTableRootPath() returns an IP address instead of the host name?

Some of our servers are not in the domain and are accessible only by their IP address.

Upvotes: 1

Views: 200

Answers (1)

sniperd
sniperd

Reputation: 5274

I think you have a few options, this should give you the IP of the SQL box:

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;

or if you have xp_cmdshell enabled, you could do something like:

exec xp_cmdshell 'ipconfig'

Upvotes: 1

Related Questions