0

I'm writing an insert into a linked server table that includes the IP the of the local server. When SSMS into the server and exec the SP, it provides the correct information into the Linked table.

When the SQL Agent runs the job for itself its returning 'NULL' and inserting Null into the remote table instead of the local IP. I'm sure this is because there is no "local" IP being used as it is using its only ports ect.

Specifically talking about the Connectionproperty('local_net_address)

set @vcLocalIP= convert (varchar,CONNECTIONPROPERTY('local_net_address'))

Any Help or Ideas on this would be greatly appreciated. Just trying to craft this SP so it can be put on different servers and all return the relevant information with as little "manual" intervention as possible.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • This could be because the SQL Agent is accessing the SQL Server via Shared Memory as opposed to connecting via TCP. – Martin Jul 07 '15 at 14:27
  • See also this answer, which talks about the `local_net_address` being `null` when using shared memory: http://stackoverflow.com/a/14695530/2169762 – Martin Jul 07 '15 at 14:28

0 Answers0