1

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.

shA.t
  • 16,580
  • 5
  • 54
  • 111
mshakurov
  • 64
  • 6

1 Answers1

1

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'
sniperd
  • 5,124
  • 6
  • 28
  • 44
  • thanks, of course, we know many ways to determine the addresses of the server interfaces. we want to know, maybe there is a setting that will allow built-in functions, such as FileTableRootPath (), to return a specific ip address from all assigned interfaces. – mshakurov Jul 27 '18 at 11:24
  • I'm not aware of `Defined Functions` that specifically do that. You could make a `User Defined Function` and use the above code though. – sniperd Jul 27 '18 at 12:36