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 2005 Forums
 Transact-SQL (2005)
 os user

Author  Topic 

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2007-03-07 : 02:14:35
Hi pals,

Using SELECT stmt how to get OS username.

Regards,
franky

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-07 : 02:18:53
select system_user


KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-07 : 02:20:27
[code]select suser_sname()[/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2007-03-07 : 02:30:18
HI,

using SELECT stmt how to retrieve the Remote machine IP and OS user who is getting connected to the database server.


Thanks in advance,

Regards,
franky
Go to Top of Page

frank.svs
Constraint Violating Yak Guru

368 Posts

Posted - 2007-03-07 : 02:33:58
Thanks but i need the Windows Operating System User name
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-07 : 02:43:17
"i need the Windows Operating System User name"

system_user or suser_sname will give you Windows OS user name if you logged on with Windows authentication. Otherwise, how would you expect SQL Server to return OS user name?

Also for getting remote user's IP and name, you need to take help of your network admin to monitor who is connecting to the server.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-03-07 : 05:08:57
SELECT HOST_NAME()


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2007-03-08 : 16:26:46
do a..

select * from master..sysprocesses

this will give you the info you need judging from the way this inquiry sounds


HTH

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -