[dba-SQLServer] Finding current login group

David Emerson davide at dalyn.co.nz
Thu Jul 1 17:11:45 CDT 2004


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

Regards

David Emerson
Dalyn Software Ltd
25 Cunliffe St, Churton Park
Wellington, New Zealand
Ph/Fax (04) 478-7456
Mobile 027-280-9348 




More information about the dba-SQLServer mailing list