Reputation: 73
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
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
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