witchqueen
witchqueen

Reputation: 73

sql server remote access machine ip

I wanna learn remote machine's ip adressess which accessed my sql server. someone at my job(in local network) find my database password and making row updates. how could I find the access person's ip?

Upvotes: 0

Views: 71

Answers (2)

Ferrakkem Bhuiyan
Ferrakkem Bhuiyan

Reputation: 2783

In SQL Server you can try this:

CREATE FUNCTION [dbo].[GetCurrentIP] ()
RETURNS varchar(280)
AS
BEGIN
    DECLARE @IP_Address varchar(280);

    SELECT @IP_Address = client_net_address
    FROM sys.dm_exec_connections
    WHERE Session_id = @@SPID;

    Return @IP_Address;
END

Upvotes: 4

Anthony Horne
Anthony Horne

Reputation: 2522

Add a trigger to the table that adds the server variables like host name to a separate table. See trigger on update. Also select host_name.

Upvotes: 0

Related Questions