Tuesday, June 15, 2010

Get client IP address in SQL server

Get client machine IP address in SQL server.

DECLARE @IP_Address varchar(255)

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

PRINT @IP_Address

No comments:

Post a Comment