Answered updating with user IP

  • Saturday, April 28, 2012 6:19 AM
     
     
    can I get a column to update with the IP address of who called the update?

All Replies

  • Sunday, April 29, 2012 1:42 AM
    Moderator
     
     Answered

    hi,

    SELECT client_net_address
      FROM sys.dm_exec_connections
      WHERE session_id = @@SPID;

    returns the IP address of the remote machine where the statement has been generated, or "<local_machine>" if you are locally connected over shared memory transport layer, but requires high sysadmins privileges... perhaps you can encpsulate within a EXECUTE AS "sysadmin_user" grant in a stored procedure, but did not tested it.. more,  it's difficult to rely on IP to identiy "clients" if the network uses dynamic IP allocation, so that today you have an ID and tomorrow another one, or if NAT performs port sustitution, so that only the internal gateway of the NAT service will know the real internal IP address which will be a generic one shared among all the outgoing clients...

    regards


    http://www.asql.biz - DbaMgr2k - DbaMgr and further SQL Tools http://www.hotelsole.com/

    • Marked As Answer by KJian_ Wednesday, May 09, 2012 2:51 AM
    •  
  • Friday, May 04, 2012 11:53 AM
     
     

    Please check the link provide you below. It may help you .

    http://www.neowin.net/news/newly-found-skype-exploit-can-reveal-users-ip-address