selecting the network address in sql
Does anyone know how to select/locate the network address for a login connection
to sql? The network address is found in the 'current activity' portion of
enterprise manager and I was just wondering how I can select the network
address with a t-sql statement for a particular login id.
Thanks
# 1 Re: selecting the network address in sql
I think you hostname in the sysprocesses in the master db. Check out this
(sql server 2000) query:
SELECT p.spid
,convert(char(12), d.name) db_name
, program_name
, convert(char(12), l.name) login_name
, convert(char(12), hostname) hostname
, cmd
, p.status
, p.blocked
, login_time
, last_batch
, p.spid
FROM master..sysprocesses p
JOIN master..sysdatabases d ON p.dbid = d.dbid
JOIN master..syslogins l ON p.sid = l.sid
ORDER BY 2,IsNull(Ltrim(program_name),"ZZZZZZZZZ"),4,5
--
HTH,
David Satz
Principal Web Engineer
Hyperion Solutions
"sheryl kemp" <dianedinero@aol.com> wrote in message
news:3df65936$1@tnews.web.dev-archive.com...
>
> Does anyone know how to select/locate the network address for a login
connection
> to sql? The network address is found in the 'current activity' portion of
> enterprise manager and I was just wondering how I can select the network
> address with a t-sql statement for a particular login id.
>
> Thanks
# 2 Re: selecting the network address in sql
Sheryl
David is indeed right the sysprocesses table does contain the network address
(the mac address of the remote PC) but if it is the HOSTNAME you are after,
a far simpler method is the sp_who stored procedure. This stroed procedure
returns most of the info that 'Current Activity' does.
refer to T-SQL Help for a full description of it.
rgds
Iain
"sheryl kemp" <dianedinero@aol.com> wrote:
>
>Does anyone know how to select/locate the network address for a login connection
>to sql? The network address is found in the 'current activity' portion
of
>enterprise manager and I was just wondering how I can select the network
>address with a t-sql statement for a particular login id.
>
>Thanks