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
 General SQL Server Forums
 New to SQL Server Programming
 How to get Machine name.

Author  Topic 

Amjath
Yak Posting Veteran

66 Posts

Posted - 2006-02-15 : 05:30:06
hai i want the name of the system which executes a SP in sql server is it possible. by using this i can log data by keeping this request is done by person from this machine.

is this possible.

Any one help me.
Thanx in advance.

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2006-02-15 : 06:00:37
The name of the system or the name of the machine?

to get the name of the machine you can use:

select @@SERVERNAME


Duane.
Go to Top of Page

Amjath
Yak Posting Veteran

66 Posts

Posted - 2006-02-15 : 06:22:49
hi Duane,
Sorry i didnt get u.

my Query is. i want to get the machine name from where the request is create for execute that sp.

for example. i have a sql server
and four client machine, i want to update a date in particular table. so i want to know from which machine sql server got the request.
Is it Possible.

Thanx in advance.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-15 : 06:24:24
[code]select host_name()[/code]

----------------------------------
'KH'

everything that has a beginning has an end
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2006-02-15 : 06:26:12
OK.

Try this then:

select suser_sname()
--for the logon

select host_name()
--for the machine name


Duane.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-15 : 06:52:42
Also make use of sp_who, sp_who2

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Amjath
Yak Posting Veteran

66 Posts

Posted - 2006-02-15 : 07:38:49
Thanx to all for make this help.


With Regards
-Amjath
Go to Top of Page
   

- Advertisement -