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 |
|
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?Brett8-) |
 |
|
|
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. |
 |
|
|
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 |
 |
|
|
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 |
 |
|
|
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 |
 |
|
|
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 |
 |
|
|
|
|
|
|
|