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)
 Current user logged in

Author  Topic 

vusil
Starting Member

22 Posts

Posted - 2005-03-22 : 09:16:49
Hi All,
Some help with aliased users please.

I have a database where access is through an aliased user.
What I'm tryin to retrive is the current user who logged in rather than the aliased user.
I've tried using user, current_user, session_user, system_user, suser_name but they all return the alised user name.

Can this be done?

Thanks.

X002548
Not Just a Number

15586 Posts

Posted - 2005-03-22 : 13:08:30
What's an aliased user?



Brett

8-)
Go to Top of Page

vusil
Starting Member

22 Posts

Posted - 2005-03-24 : 01:28:04
What I mean is that the logins are mapped to a user name in the database.
I want to retrieve the current login name instead of the current user.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-03-24 : 01:32:08
How about this:

select loginame from sysprocesses where spid = (select @@spid)



Tara
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-24 : 02:51:14
Does this not work for You ?
select suser_sname()

When You say alias user, do You mean a login that is mapped to a user by sp_addalias ?
Are You on SQL7 or SQL2000 ?

What do the system functions you listed return, and what would You want them to return ?

rockmoose
Go to Top of Page

chix001
Starting Member

1 Post

Posted - 2005-06-24 : 13:33:42
I am in a similar situation...

I have an application that uses SQL security to do database-y things. And that's a generic app_user type login - not very helpful when trying to audit trail something. But the users DO log into the Active Directory (Windows domain) - is there any way I can see those credentials from inside, say, a stored procedure or trigger?

Thanks,
Amanda
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-24 : 13:37:08
You can get to Active Directory by setting up a linked server to it. I've never done it, but if you google it, you should be able to find some information.

Tara
Go to Top of Page
   

- Advertisement -