Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to set up Active Directory authentication for my users, who will be assigned to specific database roles. I also need to log activity and ensure I have captured the IDs of the indivudals connected.

I have found simple instructions on how to do it. ( How do I assign an entire Active Directory group security access in SQL Server 2008? )

... But Will SYSTEM_USER return the logon id of the active directory connection or the individual user? (Unfortunately I cannot test this!)

share|improve this question
    
What is getuserid()? –  Derek Kromm Jul 16 '12 at 16:14
    
There is no built-in getuserid() function in SQL. Are you talking about the GETUSERID() function available in Report Builder (for Reporting Services)? –  squillman Jul 16 '12 at 16:16
1  
    
Sorry, My Bad - I meant SYSTEM_USER –  littlebobbytables Jul 16 '12 at 16:36

1 Answer 1

A call to system_user will return the AD user's name in your case. For instance, if you have a user set up as YourDomain\YourUser1:

select system_user

-- this returns "YourDomain\YourUser1"

If YourDomain\YourUser1 is part of a AD group (i.e. YourDomain\YourGroup1), then it would still have the same output as above (returning "YourDomain\YourUser1").

share|improve this answer
    
Shark - perfect, thank you. –  littlebobbytables Jul 17 '12 at 8:24
    
Jon - I didn't spot the link you posted earlier. No reference to AD but a good reference to know about, thanks. –  littlebobbytables Jul 17 '12 at 8:28
    
@littlebobbytables Glad to help. Please consider up voting and accepting this answer. –  Thomas Stringer Jul 17 '12 at 12:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.