I am trying to fetch IP address of the SQL Server through Query with below commands and it is working fine. But when I add it in a job it is not fetching/showing the IP. Please help.
Select cONVERT(VARCHAR,CONNECTIONPROPERTY('local_net_address') )
select local_net_address FROM sys.dm_exec_connections WHERE SESSION_ID = @@SPID
Problem is when i run this in a job and assign it to a variable it is not showing the IP.