Thinking outside the box

Patron Saint of Lost Yaks
posts - 203, comments - 734, trackbacks - 4

My Links

Advertisement

News

Archives

Post Categories

Get client IP address

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

Or this

 

SELECT  *
FROM    sys.dm_exec_connections
WHERE   session_id = @@SPID

Print | posted on Saturday, March 20, 2010 9:48 PM | Filed Under [ SQL Server 2008 Administration ]

Feedback

Gravatar

# re: Get client IP address

Good..thanks
3/15/2011 6:20 AM | K.E.M Asif
Gravatar

# re: Get client IP address

pls can you send my client IP adress/ pls........
6/25/2011 7:13 PM | arben
Gravatar

# re: Get client IP address

thanks a lot
7/24/2011 9:09 AM | Faris
Gravatar

# re: Get client IP address

Many thanks!
10/19/2011 4:59 PM | Rippi
Gravatar

# re: Get client IP address

SELECT *
FROM sys.dm_exec_connections
WHERE session_id = @@SPID

works with sql server 2005 .. great job man... thx a lot!!!
2/1/2012 10:35 AM | thankful
Gravatar

# HOPEFULL I GET THE BEST CLIENT

dear client are u intresting with ACEPACK VANTURE SDN BHD? PLIZ CALL ME
IF U WANT KNOW MORE ABOUT MY COMPANY..THANX..
10/12/2012 5:47 AM | ANDRIAN AV
Comments have been closed on this topic.

Powered by:
Powered By Subtext Powered By ASP.NET