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)
 How to find out the logged in user

Author  Topic 

chetan_dba
Starting Member

21 Posts

Posted - 2008-03-24 : 03:28:24
Hi,
I wanted to know How can i find out that with which user i am logged in. Is there any command to find out the same.
( like in oracle, we have command -- showuser, which will return the logged in user of your session).

Thanks in advance.
-- Chetan

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-03-24 : 03:33:30
EXEC sp_who
Go to Top of Page

Koji Matsumura
Posting Yak Master

141 Posts

Posted - 2008-03-24 : 04:01:47
SELECT SUSER_SNAME()
Go to Top of Page

chetan_dba
Starting Member

21 Posts

Posted - 2008-03-24 : 05:43:47
Thanks..
SELECT SUSER_SNAME() -- it worked..

Thanks in advance.
-- Chetan
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-24 : 13:55:18
or CURRENT_USER
Go to Top of Page

Koji Matsumura
Posting Yak Master

141 Posts

Posted - 2008-03-24 : 20:15:33
CURRENT_USER is user name. Not login name.
Go to Top of Page
   

- Advertisement -