Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Security Audit pre-IPSEC

Author  Topic 

clarkbaker1964
Constraint Violating Yak Guru

428 Posts

Posted - 2004-11-12 : 18:11:13
I am identifying NT accounts and the machines they are running from with the following statement... How can I get the IP address information from the Select?
If I have to ping for the results how can I run this information back to my Query.


SELECT Distinct
RTrim(p.program_name) As Program,
RTrim(d.[name]) as db,
convert(sysname, rtrim(p.loginame)) as loginname,
RTrim(p.hostname) as Machine
from master.dbo.sysprocesses p With (nolock) Inner Join sysdatabases d With (nolock) On p.dbid = d.dbid


nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-12 : 18:44:40
ping?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2004-11-12 : 20:12:36
well, you could probably use xp_cmdshell to accomplish this. although you'll have to trim up the results in order to get the IP address you want.

btw, this most likely isn't possible inline in the query. You'll have to create a temp table with the data in your current select, plus an additional column for the IP. After that is complete, you'll have to loop through the table pinging each name one at a time and updateing the row with the IP address value.

Once done, just select the contents of the table and you are done.

Seems kinda messy to me though.


-ec
Go to Top of Page
   

- Advertisement -