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.
| Author |
Topic |
|
martinch
Starting Member
35 Posts |
Posted - 2005-04-07 : 08:31:35
|
Hi all,For various reasons our server is set up to use SQL Server Authentication (the decision was made before I got here). Is it possible to determine which machine is calling the stored procedure?E.g. I have a stored procedure called "sp_Login". When sp_Login is called, is it possible to determine the machine originating the call from within sp_Login? I.e. if I have a front-end on a machine "Me", which gets the SQL Server to run sp_Login, it should return "Me" as the machine name.Any help would be greatly appreciated!Thanks  |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-04-07 : 08:52:23
|
| Run sp_who and see the HostName columnMadhivananFailing to plan is Planning to fail |
 |
|
|
martinch
Starting Member
35 Posts |
Posted - 2005-04-07 : 09:25:25
|
Cheers |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-04-07 : 19:53:36
|
HOST_NAME Returns the workstation name.select HOST = HOST_NAME ( ) CODO ERGO SUM |
 |
|
|
martinch
Starting Member
35 Posts |
Posted - 2005-04-08 : 03:07:36
|
Thanks Michael - seems a bit nicer than playing around with the large set returned by sp_Who ++EDIT: Can't seem to type today |
 |
|
|
martinch
Starting Member
35 Posts |
Posted - 2005-04-08 : 07:33:15
|
On a related note, is it possible to get the IP Address of the workstation as well? Typing "IP" into B.O.L. doesn't bring up anyting useful |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-04-08 : 08:30:06
|
| No, you can't get IP address, but the sysprocesses table will have the MAC address (net_address column). You can run the netview command to list the computers connected to the network, and match up MAC address to IP address.Note that if your SQL Server is being used by a web server, then this numbers will be meaningless. The only way to get a web client's IP address in the database is to pass it via a stored procedure parameter. |
 |
|
|
martinch
Starting Member
35 Posts |
Posted - 2005-04-08 : 08:39:26
|
Thanks Rob - very helpful. (and no, we weren't looking to catch the IP address of a web user, as it'd just return our web server's IP [I think]) |
 |
|
|
|
|
|