How to get the client IP address from SQL Server
Posted by
Saranpselvam under
Sql Server on 4/2/2014 10:04:26 AM |
Points: 75 | Views : 2389 | Status :
[Member]
HI
This is one of the way we can get IP address of the DB
CREATE FUNCTION [GetIPAddressOfCurrentDB] ()
RETURNS varchar(255)
AS
BEGIN
DECLARE @IP varchar(255);
SELECT @IP = client_net_address
FROM sys.dm_exec_connections
WHERE Session_id = @@SPID;
Return @IP;
END
Thanks