[dba-SQLServer] Finding current login group

Francis Harvey HARVEYF1 at WESTAT.com
Tue Jul 6 08:55:19 CDT 2004


David,

I am catching-up after my holiday, so I probably missed something.
You tried CURRENT_USER and didn't like that, so what happened when you
tried SUSER_SNAME instead? I'm just working my way through the BOL
"Functions That Return User Names and User IDs" article which I 
assumed was your starting reference. I can setup an account to mimic
your conditions if necessary, but I was hoping you could just let us
know what the results of this function with your actual account were.

Francis R Harvey III
WB 303, (301)294-3952
harveyf1 at westat.com

> -----Original Message-----
> From: dba-sqlserver-bounces at databaseadvisors.com 
> [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf 
> Of David Emerson
> Sent: Thursday, July 01, 2004 6:12 PM
> To: dba-SQLServer at databaseadvisors.com
> Subject: [dba-SQLServer] Finding current login group
> 
> 
> SQL2000
> 
> I am using Windows Authentication.  I have set up Windows 
> groups that users 
> belong to.  These groups are set up in SQL as logins (this 
> means that new 
> users just need to be added to the windows group to be given 
> access to all 
> the databases with permissions for the group).
> 
> Within my ADP I need to find out what login the user has 
> accessed the SQL 
> database from so that I can show/hide controls etc.  However, 
> when I use 
> the CURRENT_USER variable in a Sproc it returns the user, not 
> the group 
> they have come in by.
> 
> EG - egas\David is a member of egas\BillingUsers Group.  
> egas\BillingUsers 
> is set up as a login in SQL (egas\David is not).  When 
> egas\David is using 
> a database he has accessed it because he is a member of 
> egas\BillingUsers.  Is there a way to find out the login that 
> was used for 
> egas\David to get in (CURRENT_USER returns egas\David, I want 
> egas\BillingUsers)?
<snip>



More information about the dba-SQLServer mailing list