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
 Transact-SQL (2000)
 Users IP Address

Author  Topic 

stryderdan
Starting Member

1 Post

Posted - 2002-11-20 : 11:40:28
I am looking for a way to return the IP address of the users running a Trigger. The Trigger copies any item deleted from a table into a 'deletes' table, I am timestamping the record but would also like to get the IP address of the person deleting. I have to use the IP because we have multible users with the same log-in (not my design).
Thanks for ANY help,
Dan

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-11-20 : 12:12:40
There's nothing built-in to SQL Server that will get you an IP address, and if the data is being updated through a web interface you'd have to explicitly pass the user's IP address, anything else would return the web server's IP.

Take a look in Books Online under HOST_NAME() and HOST_ID(). These functions return the machine name of the computer that made the connection. Not exactly an IP but it might help. You can modify the trigger to log this info whenever the trigger fires.

Go to Top of Page
   

- Advertisement -