Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting client IP adresses?

Status
Not open for further replies.

kalto

Programmer
Apr 1, 2004
14
0
0
CA
Is there a function in SQL Server that can get the IP address of the client running the query?

Like "SELECT something, fn_clientipaddr() AS ipaddr FROM some_table" would returns something like that:

something ipaddr
--------- ------
somevalue 192.168.0.1

192.168.0.1 being my IP

Anyone got a hint?
 
AFAIK the closest match is master.dbo.sysprocesses... net_address contains NIC address.
 
I guess i could work with that.

The other question is, how can i get my SPID? ;)
 
Thanks again :)

I got another question tough.

I just realised that you can't use the "USE" statement in a view or functions, so my question is, how can i access the master database from a view?
 
Through [[[server.]database.]owner.]object syntax:

create view v_blahview
as
select * from master.dbo.sysprocesses
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top