Get client IP address
- by Peter Larsson
Up until now, I have used convuluted approaches to get the current user client IP-address.
This weekend I browsed Books Online for SQL Server 2008 R2 (November CTP) and found this new cool function!
SELECT CONNECTIONPROPERTY('net_transport') AS net_transport,
CONNECTIONPROPERTY('protocol_type') AS protocol_type,
CONNECTIONPROPERTY('auth_scheme') AS auth_scheme,
CONNECTIONPROPERTY('local_net_address') AS local_net_address,
CONNECTIONPROPERTY('local_tcp_port') AS local_tcp_port,
CONNECTIONPROPERTY('client_net_address') AS client_net_address
//Peter